简体   繁体   English

Android:在RecyclerView中使视图可见,而无需调用notifyDataSetChanged()

[英]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.

相关问题 Recyclerview 刷新项目甚至无需调用 notifyDataSetChanged() - Recyclerview refreshing items without even calling notifyDataSetChanged() Android-RecyclerView notifyDatasetChanged不更新布局视图 - Android - RecyclerView notifyDatasetChanged not updating layout view 调用notifydatasetchanged()之后,在Recyclerview中保持视图状态不变 - Keeping state of a view constant in Recyclerview after calling notifydatasetchanged() RecyclerView .add() 在初始化适配器后无需调用 .notifyDataSetChanged() 即可工作 - RecyclerView .add() is working without calling .notifyDataSetChanged() after initializing adapter 如何使视图仅对 recyclerview android 中单击的项目可见 - How to make view visible to only the item clicked in recyclerview android 如何使视图不占用任何空间,但在Android RecyclerView中仍然可见? - How to make view not to take any space but still be visible in Android RecyclerView? Android RecyclerView:notifyDataSetChanged() IllegalStateException - Android RecyclerView : notifyDataSetChanged() IllegalStateException Android:在BaseAdapter中调用notifyDataSetChanged - Android : Calling notifyDataSetChanged in BaseAdapter Android RecyclerView适配器notifyDataSetChanged无法正常工作 - Android RecyclerView Adapter notifyDataSetChanged not working 在 Android 中使用带 RecyclerView 的 notifyItemRemoved 或 notifyDataSetChanged - using notifyItemRemoved or notifyDataSetChanged with RecyclerView in Android
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM