Dont want soft keyboard to automatically show on launch - Android [duplicate]

送分小仙女□ 提交于 2019-12-09 14:57:00

问题


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?


回答1:


You can try:

android:windowSoftInputMode="stateHidden"

for your activity in AndroidManifest.xml




回答2:


Add this two lines to you main layout.

android:descendantFocusability="beforeDescendants"
android:focusableInTouchMode="true"



回答3:


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

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


来源:https://stackoverflow.com/questions/11542797/dont-want-soft-keyboard-to-automatically-show-on-launch-android

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!