GridView长按短按冲突
来源:互联网 发布:centos 安装lamp环境 编辑:程序博客网 时间:2024/06/01 23:28
在项目中为GridView设置长按和短按监听时,会出现短按正常,但是长按时会先执行长按,然后再执行短按,这就造成了长按时与短按监听冲突。查看OnItemLongClickListener的源码
/** * Callback method to be invoked when an item in this view has been * clicked and held. * * Implementers can call getItemAtPosition(position) if they need to access * the data associated with the selected item. * * @param parent The AbsListView where the click happened * @param view The view within the AbsListView that was clicked * @param position The position of the view in the list * @param id The row id of the item that was clicked * * @return true if the callback consumed the long click, false otherwise */ boolean onItemLongClick(AdapterView<?> parent, View view, int position, long id);
发现这么一句注释**@return true if the callback consumed the long click, false otherwise**,如果回调消耗了长时间单击,则返回true,否则为false,那么在OnItemLongClickListener的最后将return false改为return ture,就解决了长按与短按的冲突。
阅读全文
0 0
- GridView长按短按冲突
- GridView 按钮冲突问题
- scollview 冲突gridview
- 嵌套gridview冲突处理
- 解决ScrollView和GridView冲突
- SrollView中嵌套GridView冲突
- ScrollView嵌套GridView冲突解析
- ScrollView与GridView的冲突
- ScrollView嵌套ListView、GridView冲突
- 【Android】ScrollView和ListView、GridView冲突
- ListView/GridView与ScrollView Scrollbar冲突问题。
- ScrollView和ListView、GridView冲突解决
- ListView/GridView与ScrollView Scrollbar冲突问题。
- Android 解决ScrolView嵌套GridView冲突问题
- android ScrollView与ListView,GridView滑动冲突
- ScrollView和GridView滚动冲突的解决
- ScrollView 嵌套 listView、gridView 冲突的解决方案
- GridView的点击事件冲突解决
- S
- hdu 6055 Regular polygon
- c++ STL vector如何删除
- [BZOJ]1717 [Usaco2006 Dec]Milk Patterns 二分答案
- Codeforces 8C Looking for Order(状压DP)
- GridView长按短按冲突
- Java的一些小总结
- Comparable与Comparator的区别
- DAY45 数据库--MySQL2
- $("#id")[0]问题
- 子树/最近公共祖先
- unicode,ansi,utf-8,unicode big endian编码区别 --篇2
- linux ssh 免密登录
- 进程管理--之三