[英]Hide soft keyboard on tablet not working?
我有一个带有几个edittext框的Android应用程序。 我遇到的问题是,当您打开不需要的屏幕时,键盘会自动弹出。 这仅在平板电脑上发生,而在键盘未显示的手机上发生。 我已将此代码添加到我的onCreate中,但没有区别。
InputMethodManager imm = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(getCurrentFocus().getWindowToken(), 0);
知道为什么键盘不会在手机上显示而是在平板电脑上每次显示吗?
尝试将以下行添加到您在androidmanifest.xml中的活动: android:windowSoftInputMode =“ stateHidden”
<activity
android:label="eMuse"
android:windowSoftInputMode="stateHidden"
android:name=".MainClass" >
<intent-filter >
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.