我创建了一个如下所示的RecyclerView
:
recyclerView.setLayoutManager(new GridLayoutManager(getContext(), cols, LinearLayoutManager.VERTICAL, stickToBottom);
recyclerView.setAdapter(adapter);
// completely disable animations... just to test if this solves the problem
recyclerView.setItemAnimator(null);
我长按一个图标并开始滚动,有时会导致已回收视图看起来像是被按下...我在我的RecyclerView项上使用简单的"android:background="?android:attr/selectableItemBackground""。如何解决这个问题或者什么可能是根本原因?
一些事实:
- 回收视图正常工作,文本和图片更新如预期。 - 仅仅背景没有重置,即使项目没有被触摸,看起来仍然是被按下的... - 我正在WindowManager中使用RecyclerView而不是在Activity中使用。