主要是利用这个descendantFocusability属性的三个值,来调整
beforeDescendants:viewgroup会优先其子类控件而获取到焦点
afterDescendants:viewgroup只有当其子类控件不需要获取焦点时才获取焦点
blocksDescendants:viewgroup会覆盖子类控件而直接获得焦点
面对情况不同建议三个value试一下。
焦点控制技巧
本文介绍了如何通过设置descendantFocusability属性的三个值(beforeDescendants、afterDescendants、blocksDescendants)来实现对ViewGroup及其子视图焦点获取的精确控制。beforeDescendants使ViewGroup优先于子视图获取焦点;afterDescendants则是在所有子视图都不需要焦点时,ViewGroup才获取焦点;blocksDescendants则是ViewGroup直接获取焦点,忽略子视图。
主要是利用这个descendantFocusability属性的三个值,来调整
beforeDescendants:viewgroup会优先其子类控件而获取到焦点
afterDescendants:viewgroup只有当其子类控件不需要获取焦点时才获取焦点
blocksDescendants:viewgroup会覆盖子类控件而直接获得焦点
面对情况不同建议三个value试一下。

被折叠的 条评论
为什么被折叠?