在滚动页面时,onBindViewHolder()没有调用。
由于Scrollview,mAdapter.notifyDataSetChanged()没有正确地更新数据。我在“回收器”中只选中了3个复选框。在加载了第二组数据并调用通知器之后,更多的复选框被不相关地选中,但是数据仍然正确地来自于模型类。
我不能在这里分享代码,因为安全原因。我已经花了一天时间来修理。还没修好。
然后我试着移除滚动视图,它成功了。
我还有更多的看法适合在滚筒内。所以我把它作为一个布局添加到回收器的第一个位置。啊,真灵。不过,只要我想要的时候,从零碎开始,它就会到来。有什么办法至少解决这个问题吗。
发布于 2016-11-07 07:15:31
@Ogande,谢谢。我试过你的密码了。同样的事情也在发生。所以我尝试用不同的解决方案,正如我在我的问题中提到的。
我删除了滚动视图,只保留了“回收视图”。
我在适配器中添加了两个布局。因此,每当我想要添加新布局时,我都会将一个布尔值从片段传递给适配器,作为true,并且在开始时,所有位置都将默认值作为false。因此,notifychanged()将反映新布局对适配器的更改。
就像我预料的那样运作得很好。
发布于 2016-10-28 08:38:56
我认为你应该用android.support.v4.widget.NestedScrollView代替android.support.v4.widget.NestedScrollView
例如:
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true" >
<android.support.design.widget.AppBarLayout
android:id="@+id/app_bar"
android:layout_width="match_parent"
android:layout_height="@dimen/app_bar_height"
android:fitsSystemWindows="true"
android:theme="@style/AppTheme.AppBarOverlay">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
app:layout_collapseMode="pin"
app:popupTheme="@style/AppTheme.PopupOverlay" />
</android.support.design.widget.AppBarLayout>
<android.support.v4.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior" >
<!-- Place RecyclerView in here-->
</android.support.v4.widget.NestedScrollView>
</android.support.design.widget.CoordinatorLayout>https://stackoverflow.com/questions/40288920
复制相似问题