Listview中item无法点击的问题

来源:互联网 发布:电子表格数据样板 编辑:程序博客网 时间:2024/05/22 11:44

Listview中因含有Checkbox,Button等引起的item不能点击的问题:

descendantFocusability属性

在这里就需要用到android中的一个descendantFocusability属性,该属性值也有如下三种:

beforeDescendants:表示ViewGroup会优先其子类控件而获取到焦点;afterDescendants:表示ViewGroup只有当其子类控件不需要获取焦点时才获取焦点;blocksDescendants:表示ViewGroup会覆盖子类控件而直接获得焦点。

只要在listview的item根布局里加上android:descendantFocusability=”blocksDescendants”就能完美解决

阅读全文
1 0
原创粉丝点击