更改图库所选项目的外观
我的布局上有“Gallery”,我创建了一个继承自 BaseAdapter 的类,将其设置为 Gallery 适配器
GalleryAdapter extends BaseAdapter
,我使用了它
setAdapter(new GalleryAdapter
并且工作正常。
但现在我需要更改图库中选定的视图,我需要在适配器中使用它。
无论如何,有没有办法知道这个“视图”是否是从适配器中选择的,以便我可以更改它的外观?
i have "Gallery" on my layout, and i created a class inherits from BaseAdapter, to set it as Gallery adapter
GalleryAdapter extends BaseAdapter
and i used it
setAdapter(new GalleryAdapter
and it works fine.
but now i need to change the selected view within the gallery, i need it within the adapter.
is there anyway to know if this "View" is selected from the Adapter so i can change the look of it?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
最简单的方法是创建一个状态列表可绘制对象(请参阅此处)并将“选定”状态自定义为您想要的任何状态。然后,您提供此可绘制对象作为该项目的背景。
The easiest way to do this is to create a statelist drawable (see here) and customize the "selected" state to whatever you want there. Then you provide this drawable as the background for the item.