在listview的item中,添加一个button,可能会出现无法响应的问题,因为listview默认的是item中button的响应事件,所以listview的setOnItemClickListener方法可能无效
在item外层布局中添加
android:descendantFocusability="blocksDescendants"
beforeDescendants:viewgroup会优先其子类控件而获取到焦点
afterDescendants:viewgroup只有当其子类控件不需要获取焦点时才获取焦点
blocksDescendants:viewgroup会覆盖子类控件而直接获得焦点