Prevent EditText from automatically focusing

前端 未结 5 506
心在旅途
心在旅途 2021-01-14 08:43

I have an Android activity and there is one EditText in the whole layout. For some reason, whenever the activity starts, the keyboard comes up. I have tried

5条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2021-01-14 09:01

    I know this is super old, but find that adding this to your root view in the XML file usually helps to prevent this issue:

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

提交回复
热议问题