简体   繁体   中英

How to change Auto Focus on EditText in Java Android Studio?

I call the function to open the dialog. Dialog boxes have two EditText . When I open the dialog box, the keyboard automatically pops up. How can I disable this behavior? I only need to open the keyboard when the EditText receives a touch event.

on your onCreate() method

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

If you want all your activity use soft keyboard use this in your manifest file for your all activities

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

Add this lines in your Androidmanifest.xml file android:windowSoftInputMode="stateHidden"

Example :-

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM