设置图库中视图的 onClick 方法会禁用图库的 fling
Gallery 的每个窗格都包含多个视图,我需要区分它们的单击 - AdapterView.OnItemClickListener() 仅指示 Gallery 被单击。同时实现图库浏览和视图点击的最佳方法是什么?
Each of the Gallery's panes hold more than a single view and I need to differentiate between their clicks - AdapterView.OnItemClickListener() just indicates that the Gallery was clicked. What's the best way to get both Gallery flinging and view clicking simultaneously?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
在您的点击侦听器中,返回
false
。返回false
意味着事件未被消耗,并将事件传播到可能正在观看同一事件的其他视图。In your click listener, return
false
. Returningfalse
means that the event was not consumed and to propagate the event to other views who may be watching the same event.项目布局的某些部分不应包含可点击的项目。如果您触摸该部分并尝试滑动,它应该会起作用。
Some part of your item layout shouldn't contain a clickable item. If you touch that part and try swiping, it should work.
这正是我所需要的:
https://github.com/pakerfeldt/android-viewflow
This does exactly what I needed:
https://github.com/pakerfeldt/android-viewflow