英文:
is it possible to have two RecyclerViews on top of each other and make them both clickable?
问题
我的 XML 文件: recyclerViewOverlay 是用来放置空白的图像框架的。recyclerView 包含了实际的图像。
模拟器截图:
我的问题: 当我在 recyclerView 中添加了一个实际的图像,例如在位置 0,我将 recyclerViewOverlay 的位置 0 设置为 view.GONE,然而,即使我将 recycrlerViewOverlay 的位置设置为 GONE,我仍然无法点击位于 recyclerView 中的位置 0。
RecyclerView.ViewHolder viewHolder = recyclerViewOverlay.findViewHolderForAdapterPosition(0);
View view = viewHolder.itemView;
view.setVisibility(View.GONE);
英文:
My XML file: recyclerViewOverlay is to have empty image frames. recyclerView holds the actual images.
Emulator screenshot:
My problem: When I add an actual image in the recycleView e.g. in position 0 I set the recyclerViewOverlay position 0 to view.GONE, however, I still cannot click on position 0 that is in the recyclerView even though I am setting the position of recycrlerViewOverlay to GONE like this:
RecyclerView.ViewHolder viewHolder = recyclerViewOverlay.findViewHolderForAdapterPosition(0);
View view = viewHolder.itemView;
view.setVisibility(View.GONE);
答案1
得分: 1
不要将两个 RecyclerView
叠加在一起。相反,在您的 RecyclerView.Adapter
的 onBindViewHolder()
中设置占位图像和实际图像。注意:为了使用占位图像,您需要预先知道图像的数量。
英文:
Don't put 2 RecyclerView
's on top of each other. Instead set placeholder and actual images in onBindViewHolder()
in your RecyclerView.Adapter
. Note: In order to use placeholders you need to know the number of images upfront.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论