How to remove focus from single editText

后端 未结 17 1507
南笙
南笙 2020-12-13 17:24

In my application I have a single EditText together with some TextViews, button and a spinner. My EditText receives focus since it is the only focu

17条回答
  •  长情又很酷
    2020-12-13 17:31

    For me this worked

    Add these attributes to your EditText

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

    After this in your code you can simply write

    editText.clearFocus()
    

提交回复
热议问题