Dont want soft keyboard to automatically show on l

2019-04-04 12:34发布

This question already has an answer here:

Everytime I open my android app, it automatically focuses the edittext box and the soft keyboard opens up. Is there a way to focus something else on start up so the keyboard doesnt show right away?

3条回答
成全新的幸福
2楼-- · 2019-04-04 12:41

Add this two lines to you main layout.

android:descendantFocusability="beforeDescendants"
android:focusableInTouchMode="true"
查看更多
看我几分像从前
3楼-- · 2019-04-04 12:47

You can try:

android:windowSoftInputMode="stateHidden"

for your activity in AndroidManifest.xml

查看更多
我欲成王,谁敢阻挡
4楼-- · 2019-04-04 12:48

Add in your layout definition (in xml file) this following options :

android:focusable="true" android:focusableInTouchMode="true"
查看更多
登录 后发表回答