在Android应用程序设置初始焦点 [英] Set initial focus in an android application

查看:1241
本文介绍了在Android应用程序设置初始焦点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的Andr​​oid应用程序,它会自动聚焦的第一个按钮我在我的布局,给它一个橙色轮廓。如何设置初始焦点preferably在XML中,并可以这样设定什么?

In my android application it automatically focuses the first Button I have in my layout, giving it an orange outline. How can I set the initial focus preferably in XML, and can this be set to nothing?

推荐答案

您可以使用 requestFocus的标签:

<Button ...>
  <requestFocus />
</Button>

我觉得很奇怪,虽然它的自动聚焦你的一个按钮,我还没有看到任何我的观点,即行为。

I find it odd though that it auto-focuses one of your buttons, I haven't observed that behavior in any of my views.

这篇关于在Android应用程序设置初始焦点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆