I have to click the button twice for it to work

前端 未结 8 1817
温柔的废话
温柔的废话 2020-12-05 04:33

So I have a button in my app and an edittext. When I click the button and write something in the edittext, a textview changes. It all works as it should except for one thing

相关标签:
8条回答
  • 2020-12-05 05:15

    If you are inflating view to another one, try to set on parent view:

    view.setFocusable(false);
    

    worked for me.

    0 讨论(0)
  • 2020-12-05 05:15

    I had the same problem as the OP. I tried all the focus-related suggestions, but none of them worked every time for me.

    I tried removing the NavigationDrawer from my layout, but that didn't work.

    Lastly, I tried replacing my CoordinatorLayout with a LinearLayout and now my buttons click first time every time. Could be worth a try.

    0 讨论(0)
提交回复
热议问题