开发者

Keyboard shows up after starting Activity because of ScrollView

开发者 https://www.devze.com 2023-03-20 03:36 出处:网络
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.

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 开发者_如何学Cway of using scrollbars?

Thanks, Force


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

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


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 ;-)

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号