[英]why does my android keyboard opens automatically?
I have this Layout. 我有这个布局。
every time it's opened, the android keyboard appears 每次打开时,都会出现android键盘
why is that? 这是为什么?
how can I avoid this? 我该如何避免呢?
Add this to your manifest file, You can avoid that. 将此添加到清单文件中,可以避免这种情况。
<activity
android:name="Your_Activity"
android:windowSoftInputMode="stateAlwaysHidden" >
</activity>
If the EditText
has requestFocus
,then keyboard might display automatically. 如果
EditText
具有requestFocus
,则键盘可能会自动显示。 It has nothing to do with your xml code. 它与您的xml代码无关。
Add the following line to your Manifest File inside each Activity tab 将以下行添加到每个“活动”选项卡中的清单文件中
android:windowSoftInputMode="stateAlwaysHidden"
or add the following to your parent layout in that activity 或将以下内容添加到该活动的父级布局中
android:descendantFocusability="beforeDescendants"
android:focusableInTouchMode="true"
Strange ! 奇怪! I thought Screen which has editText only get focus.
我以为具有editText的Screen只能得到关注。
Try this => Stop EditText from gaining focus at Activity startup 试试这个=> 阻止EditText在Activity启动时获得关注
Android opens the OnScreenKeyboard automatically if you have an EditText focussed . 如果您将EditText放在焦点上,则Android将自动打开OnScreenKeyboard。
You can prevent that by adding following into your Activity's onCreate method. 您可以通过在Activity的onCreate方法中添加以下内容来避免这种情况。
getWindow().setSoftInputMode(
WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.