隐藏softkeyboard单活动 - Android电子 [英] Hide softkeyboard in single activity - Android

查看:128
本文介绍了隐藏softkeyboard单活动 - Android电子的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在这里寻找净了一下,我似乎无法出现,当一个EditText获得焦点停止SoftKeyboard,我已经试过至少3个不同的方法,设置输入类型为None(想想我看到,在Android开发文档),以及onCreate方法内部两种不同的方式,它们分别是:

I have been searching the 'net for a bit here, I can't seem to stop the SoftKeyboard from appearing when an EditText gets focus, I've tried at least 3 different methods, setting the Input Type to None (think I saw that in the Android Dev Docs), and two different ways inside the onCreate method, they are:

getWindow().requestFeature(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);

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

我知道我可以禁用它在清单文件整个应用程序,但我只需要它在这个活动而被停用。

I know I can disable it for the entire app in the manifest file, but I only need it disabled in this activity.

推荐答案

有在使用Android 2.0和2.1的bug是prevents我从工作,试图方法,但作为写<一个href=\"http://stackoverflow.com/questions/1109022/how-to-close-hide-the-android-soft-keyboard/1845995#1845995\">here这可以解决。我没有尝试上述方法外,他们也可能工作,但我也试试我挂一个,它的工作原理。

There is a bug in Android 2.0 and 2.1 that prevents the methods I attempted from working, but as written here this can be resolved. I didn't try the above methods, they might also work, but I did try the one I linked to, and it works.

这篇关于隐藏softkeyboard单活动 - Android电子的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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