scrollview嵌套RecyclerView嵌套EditText

在ScrollView中嵌套RecyclerView,其中RecyclerView的item条目中如果有EditText,在输入文字后,出现界面退出,并报如下类似错误:

[java]  view plain  copy
  1.  Process: com.yuguo.thecarpenter.thecarpenterrepair, PID: 22957                                                                                           java.lang.IllegalArgumentException: parameter must be a descendant of this view                                                                                               at android.view.ViewGroup.offsetRectBetweenParentAndChild(ViewGroup.java:5476)                                                                                               at android.view.ViewGroup.offsetDescendantRectToMyCoords(ViewGroup.java:5401)                                                                                               at android.widget.ScrollView.isWithinDeltaOfScreen(ScrollView.java:1184)                                                                                               at android.widget.ScrollView.onSizeChanged(ScrollView.java:1599)                                                                                               at android.view.View.sizeChange(View.java:17193)                                                                                               at android.view.View.setFrame(View.java:17155)                                                                                               at android.view.View.layout(View.java:17047)                                                                                               at android.view.ViewGroup.layout(ViewGroup.java:5579)                                                                                               at android.widget.FrameLayout.layoutChildren(FrameLayout.java:396)                                                                                               at android.widget.FrameLayout.onLayout(FrameLayout.java:333)                                                                                               at android.view.View.layout(View.java:17056)                                                                                               at android.view.ViewGroup.layout(ViewGroup.java:5579)                                                                                               at android.widget.LinearLayout.setChildFrame(LinearLayout.java:2001)                                                                                               at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1844)                                                                                               at android.widget.LinearLayout.onLayout(LinearLayout.java:1753)                                                                                               at android.view.View.layout(View.java:17056)                                                                                               at android.view.ViewGroup.layout(ViewGroup.java:5579)                                                                                               at android.widget.FrameLayout.layoutChildren(FrameLayout.java:396)

解决的办法:

参考:http://stackoverflow.com/questions/7100555/preventing-catching-illegalargumentexception-parameter-must-be-a-descendant-of;

在AndroidMainfest.xml中找到该Activity,然后添加属性:

	android:windowSoftInputMode="adjustPan"

例如:
 
 
<activity
    android:name=".View.Activity.BalanceWorkOrderActivity"
    android:configChanges="keyboardHidden|orientation"
    android:windowSoftInputMode="adjustPan"
    android:theme="@style/Anim_fade" />

发布了5 篇原创文章 · 获赞 7 · 访问量 7072

猜你喜欢

转载自blog.csdn.net/jokeYJW/article/details/78490889