安卓:强制的EditText取消焦点? [英] Android: Force EditText to remove focus?

查看:193
本文介绍了安卓:强制的EditText取消焦点?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想是能够从取出的EditText焦点。例如,如果键盘出现,以及用户与后退按钮隐藏它,我想关注的焦点,并且光标消失。怎样才能做到呢?

I would like to be able to remove the focus from the EditText. For example if the Keyboard appears, and the user hides it with the back button, I would like the focus and the cursor to disappear. How can it be done?

推荐答案

您可以将它添加到的onCreate,它会隐藏键盘每次的activty开始你也可以编程的焦点切换到另一个项目。

you can add this to onCreate and it will hide the keyboard everytime the activty starts You could also programatically change the focus to another item.

    this.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);

这篇关于安卓:强制的EditText取消焦点?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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