Automatic popping up keyboard on start Activity

I got a relative simple question. I have an activity with a lot of EditText's in them. When I open the activity it automatically focusses to the first EditText and displays the virtual keyboard.

How can I prevent this?


Use this attributes in your layout tag in XML file:

android:focusable="true"
android:focusableInTouchMode="true"

As reported by other members in comments it doesn't works on ScrollView therefore you need to add these attributes to the main child of ScrollView .


您可以将其添加到Android Manifest活动中:

android:windowSoftInputMode="stateHidden|adjustResize"

I have several implementations described here, but now i have added into the AndroidManifest.xml for my Activity the property:

android:windowSoftInputMode="stateAlwaysHidden"

I think this is the easy way even if you are using fragments .

" stateAlwaysHidden " The soft keyboard is always hidden when the activity's main window has input focus.

链接地址: http://www.djcxy.com/p/24184.html

上一篇: scrollingCache?

下一篇: 在启动Activity时自动弹出键盘