Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 756
Galip Avatar asked Jan 12 '11 11:01

Galip


People also ask

How do I hide the activity on my keyboard?

You can force Android to hide the virtual keyboard using the InputMethodManager, calling hideSoftInputFromWindow , passing in the token of the window containing your focused view. This will force the keyboard to be hidden in all situations. In some cases you will want to pass in InputMethodManager.


2 Answers

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.

like image 161
Vikas Patidar Avatar answered Sep 18 '22 13:09

Vikas Patidar


You can add this to your Android Manifest activity:

android:windowSoftInputMode="stateHidden|adjustResize" 
like image 30
UKDataGeek Avatar answered Sep 19 '22 13:09

UKDataGeek