如何获取图像库中哪张图像(其位置)处于焦点?
我正在摆弄图库小部件。
我想知道如何才能获得图库中焦点图像的位置。
例如,我的画廊中有几张图片,如果我向右轻按手指,图片就会来来去去,直到停在一张为止。
如何获得当前对焦的这张图片的位置?
不知道我说得够不够清楚,如果有什么需要我补充的,请不要犹豫。 谢谢你,
I am playing around with the Gallery widget.
I would like to know how can we get the position of the image on focus in the gallery.
For example having several pictures in my gallery, if I tap my finger to the right, pictures will come and go until it stop to one.
How one can get the position of this one picture that is currently on focus ?
I don't know if I was clear enough, if there is anything you want me to add do not hesitate.
Thank you,
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在 Gallery Widget 上设置一个
OnItemSelectedListener
,覆盖适当的方法 [我认为回调名为onItemSelected(...)
]。焦点项目的位置将作为参数传递给此回调函数。伪代码:
希望有帮助......
Set an
OnItemSelectedListener
on the Gallery Widget, override appropriate method [I think the callback is namedonItemSelected(...)
]. The position of item in focus would be passed as argument to this callback function.Pseudo code:
Hope that helps...