Force
Force

Reputation: 6382

Keyboard shows up after starting Activity because of ScrollView

If my EditBox is not in a ScrollView, it won't open the keyboard automatically (which is good!) However, now it is included in one, it does this annoying thing every time I start the Activity. I already tried this, but it didn't work for me.

This is my main.xml: http://pastebin.com/qp3Nc8sf

Removing RequestFocus doesn't help either. How can I disable the keyboard on startup? Or is there even a better way of using scrollbars?

Thanks, Force

Upvotes: 1

Views: 741

Answers (2)

Force
Force

Reputation: 6382

Okay, I found the answer; I have to add android:windowSoftInputMode="stateUnchanged" to the activity in the manifest. This leaves the keyboard open while rotating as well. Nevertheless thanks for the answer Vinayak ;-)

Upvotes: 1

Vinayak Bevinakatti
Vinayak Bevinakatti

Reputation: 40503

Have u tried adding this to your onCreate function of the activity:

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

Upvotes: 1

Related Questions