实际上,从技术上讲,两个视图可以同时具有焦点 - 不仅仅是您想象的那样(并且您的用例需要):
焦点视图的父级也可以将焦点设置为 true。参照。示例视图层次结构的摘录,has-focus=true
不止一次弹出:
View Hierarchy:
+>DecorView{id=-1, visibility=VISIBLE, width=1920, height=1080, has-focus=true, has-focusable=true, has-window-focus=true, is-clickable=false,
|
+->LinearLayout{id=-1, visibility=VISIBLE, width=1776, height=1080, has-focus=true, has-focusable=true, has-window-focus=true, is-clickable=fal
|
+-->ViewStub{id=16909243, res-name=action_mode_bar_stub, visibility=GONE, width=0, height=0, has-focus=false, has-focusable=false, has-window-f
|
+-->FrameLayout{id=-1, visibility=VISIBLE, width=1776, height=1008, has-focus=true, has-focusable=true, has-window-focus=true, is-clickable=fal
|
+--->FitWindowsLinearLayout{id=2131296268, res-name=action_bar_root, visibility=VISIBLE, width=1776, height=1008, has-focus=true, has-focusable
|
+---->ViewStubCompat{id=2131296279, res-name=action_mode_bar_stub, visibility=GONE, width=0, height=0, has-focus=false, has-focusable=false, ha
|
+---->ContentFrameLayout{id=16908290, res-name=content, visibility=VISIBLE, width=1776, height=1008, has-focus=true, has-focusable=true, has-wi
|
+----->LinearLayout{id=-1, visibility=VISIBLE, width=1776, height=1008, has-focus=true, has-focusable=true, has-window-focus=true, is-clickable
|
+------>RecyclerView{id=2131296483, res-name=lstRecordings, visibility=VISIBLE, width=1776, height=873, has-focus=true, has-focusable=true, has