yww*_*ynm 16 android android-scrollview android-support-library android-recyclerview android-6.0-marshmallow
我在ScrollView中有一个RecyclerView,如下所示:
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
<!--other stuff-->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.v7.widget.RecyclerView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="gone"/>
</LinearLayout>
<!--other stuff-->
</ScrollView>
Run Code Online (Sandbox Code Playgroud)
这个RecyclerView项目是一个RelativeLayout,其中有一个EditText和其他的观点.在layout_height那RelativeLayout和EditText既是wrap_content.用户可以在EditText没有任何长度/线条限制的情况下输入,以便每个项目的高度不同.
然后我发现getItemCount()在Adapter返回true值但onBindViewHolder()被调用错误的时间(少于它应该),因此不足以显示所有项目.
我发现这只会在我写的时候发生recyclerView.setNestedScrollingEnabled(false).但我不能删除这一行.因为如果我这样做了,RecyclerView它就不会顺畅地滚动,并且与其他内部ScrollView和ScrollView自身的观点不一致.
这发生在6.0但不是4.1.
我在此页面与Google进行了沟通:https://code.google.com/p/android/issues/detail?id = 213914他告诉我这是一个错误修复程序RecyclerView.您可以访问该页面,以便更好地理解问题和我的目标(有一个小样本项目可以显示问题).即使是现在我也不同意他,我想解决这个问题.请帮忙,提前谢谢.
yww*_*ynm 75
我找到了自己的解决方案:更换ScrollView与NestedScrollView和保持recyclerView.setNestedScrollingEnabled(false).我不知道这是不是这样NestedScrollView做但它有效.
注意:
NestedScrollView不是孩子ScrollView而是FrameLayout. adjustResize.| 归档时间: |
|
| 查看次数: |
12573 次 |
| 最近记录: |