[英]Android: make a view visible in RecyclerView without calling notifyDataSetChanged()
I have building a gallery project. 我正在建立一个画廊项目。 I am using RecyclerView
to show all the images coming from server. 我正在使用RecyclerView
来显示来自服务器的所有图像。 I am using Picasso
to load the images into the Adapter
. 我正在使用Picasso
将图像加载到Adapter
。 Now I have an Edit button
on top of the RecyclerView
. 现在,我在RecyclerView
顶部有一个Edit button
。 If I click on the Edit button
I want to show a dismiss button
on every image available in the Adapter
. 如果单击“ Edit button
我想在Adapter
可用的每个图像上显示一个dismiss button
。 To make the button visible in all the items I am calling notifyDataSetChanged()
inside the Adapter after clicking the Edit Button
. 为了使按钮在所有项目中可见,在单击“ Edit Button
后,我在适配器内调用notifyDataSetChanged()
。
Problem is if I call notifyDataSetChanged()
, Picasso is loading all the images again. 问题是如果我调用notifyDataSetChanged()
,毕加索将再次加载所有图像。 How can I avoid reloading of Images again ? 如何避免再次重新加载图像?
you can hide the button by calling button.setVisibility(View.GONE);
您可以通过调用button.setVisibility(View.GONE);
来隐藏按钮button.setVisibility(View.GONE);
and on clicking editbutton use button.setVisibility(View.Visible);
并在单击编辑按钮时使用button.setVisibility(View.Visible);
to show button 显示按钮
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.