简体   繁体   English

使子视图在Android中的父视图之前获得焦点

[英]Make child view get focus before the parent view in Android

In this scenario, I need to make my child view gets the focus first before the parent view. 在这种情况下,我需要让我的子视图在父视图之前首先获得焦点。

Also, I cannot set the parent view to false as far as "focus" because I want it to be focusable after the child view gets the focus first. 此外,就“焦点”而言,我无法将父视图设置为false,因为我希望在子视图首先获得焦点后它可以聚焦。

Is there a way to achieve that using XML? 有没有办法使用XML实现这一目标?

您应该在父视图上使用android:descendantFocusability = "afterDescendants" ,并在要关注的视图上设置android:focusable="true"

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM