
在ListView中使用LinearLayout动态添加数据,LinearLayout中的控件监听事件 30
LinearLayout中有checkbox,可以选择和不选,title部位有全选按钮,怎么给checkbox添加监听事件啊...
LinearLayout中有checkbox,可以选择和不选,title部位有全选按钮,怎么给checkbox添加监听事件啊
展开
1个回答
展开全部
android:descendantFocusability // 放在listview中的item的顶级布局上。
Constant Value Description
beforeDescendants 0 The ViewGroup will get focus before any of its descendants. //Item先获取到焦点
afterDescendants 1 The ViewGroup will get focus only if none of its descendants want it. //子控件获取到焦点--- 也就是item无法获取到焦点
blocksDescendants 2 The ViewGroup will block its descendants from receiving focus. //让子控件无法获取焦点 --事实证明子控件是可以获取到焦点的。
ListView默认情况
当item有焦点时,item上的button等子控件获取不到焦点;
当子控件有焦点时,item无焦点无法响应onItemClick事件
ViewGroup.FOCUS_AFTER_DESCENDANTS:表示item的子控件优先于item获得焦点;
ViewGroup.FOCUS_BEFORE_DESCENDANTS:表示item优先于其子控件获得焦点
Constant Value Description
beforeDescendants 0 The ViewGroup will get focus before any of its descendants. //Item先获取到焦点
afterDescendants 1 The ViewGroup will get focus only if none of its descendants want it. //子控件获取到焦点--- 也就是item无法获取到焦点
blocksDescendants 2 The ViewGroup will block its descendants from receiving focus. //让子控件无法获取焦点 --事实证明子控件是可以获取到焦点的。
ListView默认情况
当item有焦点时,item上的button等子控件获取不到焦点;
当子控件有焦点时,item无焦点无法响应onItemClick事件
ViewGroup.FOCUS_AFTER_DESCENDANTS:表示item的子控件优先于item获得焦点;
ViewGroup.FOCUS_BEFORE_DESCENDANTS:表示item优先于其子控件获得焦点
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询