listView嵌套button失去焦点问题解决

来源:互联网 发布:网络推广职业规划面试 编辑:程序博客网 时间:2024/05/16 17:46
当我们使用listView嵌套button或者其它clickable控件时会出现listView的onitemClick事件不响应的问题。我们只需要在item的xml文件中的根布局中加上一句: 
Java代码  收藏代码
  1. android:descendantFocusability="blocksDescendants"  

屏蔽item中抢夺focus的控件权限即可解决问题。
原创粉丝点击