Android:单独更新图库中的图像
我正在关注画廊教程,我正在尝试弄清楚如何更改图库中的单个图像而不重新创建图库对象。我不想重新创建图库对象,因为图像每隔几秒就会更新一次,当您开始滚动图库时,然后创建一个新的图库对象,图库位置将返回到开头,这不是我想要的。
有谁知道如何单独访问图库中的每个图像以便我可以更新它?
I am following the gallery tutorial and I am trying to figure out how to change individual images in the gallery without recreating the gallery object. I dont want to recreate the gallery object because the images will be updated every few seconds, and when you start scrolling the gallery, then you create a new gallery object, the gallery position will return to the beginning, which is not what I want.
Does anyone know of a way to access each image in the gallery individually so I can update it?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以使用 getChildAt api 调用并获取特定位置的视图。然后,您可以按照您喜欢的方式更改视图的数据...如果您需要有关视图所保存的数据的更多信息,请确保在关联适配器的bindView/getView调用中将所需的数据标记到视图与画廊小部件
you can use getChildAt api call and get the view of a particular position. Then you can change the data of the view the way you like it...if you require further information on the data that your view holds make sure that you tag the the required data to the view in bindView/getView call of the adapter associated with the gallery widget