设置viewgroup和子类控件获取焦点的优先级

xml设置:android:descendantFocusability="blocksDescendants"    //afterDescendants beforeDescendants
java代码设置:ViewGroup.setDescendantFocusability(ViewGroup.FOCUS_AFTER_DESCENDANTS);
//FOCUS_BLOCK_DESCENDANTS FOCUS_BEFORE_DESCENDANTS
默认值:FOCUS_BEFORE_DESCENDANTS

beforeDescendants:viewgroup会优先其子类控件而获取到焦点

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

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

0