listview item 无法点击的简单解决(记录)

来源:互联网 发布:牛顿法迭代C语言 编辑:程序博客网 时间:2024/05/24 08:32

给listview设置属性:   android:descendantFocusability="blocksDescendants"

如:ImageButton,Button,CheckBox等子控件会拦截监听事件,让list无法响应

给listview item设置属性:  android:focusable="false"


属性的值有三种:
        beforeDescendants:viewgroup会优先其子类控件而获取到焦点
        afterDescendants:viewgroup只有当其子类控件不需要获取焦点时才获取焦点
        blocksDescendants:viewgroup会覆盖子类控件而直接获得焦点

0 0