首页 > 移动平台 > 详细

android:descendantFocusability用法

时间:2016-09-05 23:36:02      阅读:244      评论:0      收藏:0      [点我收藏+]

在ListView的item布局中可能存在CheckBox、Button、ImageButton等类似的课点击控件。这时就会发生抢焦点问题。也就是item的焦点被子控件抢走。

API描述如下:

android:descendantFocusability

Defines the relationship between the ViewGroup and its descendants when looking for a View to take focus.

Must be one of the following constant values.

 

技术分享

 

有三个属性值:

beforeDescendantsviewgroup会优先其子类控件而获取到焦点

afterDescendants:viewgroup只有当其子类控件不需要获取焦点时才获取焦点

blocksDescendants:viewgroup会覆盖子类控件而直接获得焦点

常用的是第三个。

android:descendantFocusability用法

原文:http://www.cnblogs.com/freedomwolf/p/5843939.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!