2015-07-13 90 views
0

我打电话给该功能打开对话框。对话框有两个EditText。当我打开对话框时,键盘自动弹出。我如何禁用此行为?当EditText收到触摸事件时,我只需要打开键盘。如何更改Java Android Studio中的EditText的自动焦点?

+0

http://stackoverflow.com/questions/1555109/stop-edittext-from-gaining-focus-at-activity-startup?rq=1 – Satya

+0

[可以停止EditText auto-focus?](http ://stackoverflow.com/questions/11732545/can-stop-edittext-auto-focus) –

+0

检查这些链接 http://stackoverflow.com/questions/1555109/stop-edittext-from-gaining-focus特技的活动的启动 http://stackoverflow.com/questions/11732545/can-stop-edittext-auto-focus 的http:// stackoverf low.com/questions/18295802/how-to-make-edittext-not-focused-when-creating-activity –

回答

1

您onCreate()方法

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

如果您希望您的所有活动中使用软键盘在清单文件中将其用于所有活动

<activity 
    android:configChanges="keyboardHidden|orientation" 
    android:windowSoftInputMode="stateHidden" /> 
+0

工作很棒!!!! – sabish

0

添加此行AndroidManifest.xml档案android:windowSoftInputMode="stateHidden"

: -

<activity 
      android:name=".Registration_Screen" 
      android:windowSoftInputMode="stateHidden" > 
     </activity>