Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/229.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Recyclerview在android中滚动时自动更改选定位置_Android - Fatal编程技术网

Recyclerview在android中滚动时自动更改选定位置

Recyclerview在android中滚动时自动更改选定位置,android,Android,我需要单选回收视图。但当我点击特定项目时,它被选中,但当我滚动recyclerview other positions项目时,它也被自动选中。我找不到“所有项目”视图。我刚找到可见的项目视图。我需要所有的项目视图,这是不可见的移动屏幕上,但该项目是在适配器存在。thanx提前我想你搞乱了RecycleView的财产。首先,您必须创建一个数组,然后必须在视图中传递该数组。然后,在单击回收列表的项目时,根据单击的位置,您必须在特定位置传递一些属性,并通过给出adapter.notifydataset

我需要单选回收视图。但当我点击特定项目时,它被选中,但当我滚动recyclerview other positions项目时,它也被自动选中。我找不到“所有项目”视图。我刚找到可见的项目视图。我需要所有的项目视图,这是不可见的移动屏幕上,但该项目是在适配器存在。thanx提前

我想你搞乱了RecycleView的财产。首先,您必须创建一个数组,然后必须在视图中传递该数组。然后,在单击回收列表的项目时,根据单击的位置,您必须在特定位置传递一些属性,并通过给出
adapter.notifydatasetchanged()通知您的适配器参考检查此链接

不要使用notifiyDataSetChanged()。 使用dataList.notifiItemDatachanged(int pos)` . 它将替换为特定位置,不会刷新整个列表。
你所说的被选中是什么意思?最好发布代码以更好地理解您的问题。这就是onCreateView和onBindView之间的区别 Don't use notifiyDataSetChanged(). Use dataList.notifiItemDatachanged(int pos)` . It will replace with particular position and will not refresh whole list.