我有一个RecyclerView,每个行布局中都有一个ImageView和一个TextView。在RecyclerViewAdapter的ViewHolder中,我将点击监听器设置为
v.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Images i=list.get(getAdapterPosition());
i.setFlag(!i.getFlag());
list.set(getAdapterPosition(),(i));
notifyDataSetChanged();
}
});
在这个点击监听器中,我正在更改布尔标志,以便它可以显示某个项目是否已经被选中。根据它的值,我想通过检查整个ArrayList来遍历。
for(int i=0; i<images.size(); i++){
if(images.get(i).getFlag()){
// there I want to get view from LayoutManager for that item
//but how to get view for that item and get Bitmap form imageview for that item
//end of geting view
}
}
请帮忙从Recyclerview获取特定适配器位置的视图。以下图片反映了我的问题: