ViewGroup的下面这个属性可以控制。
原文:
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.
中文表格:
beforeDescendants | viewgroup会优先其子类控件而获取到焦点 |
afterDescendants | viewgroup只有当其子类控件不需要获取焦点时才获取焦点 |
blocksDescendants | viewgroup会覆盖子类控件而直接获得焦点 |
示例:
<FrameLayout
android:id="@android:id/tabcontent"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="@android:id/tabs"
android:descendantFocusability="blocksDescendants"
>
...