I have to click the button twice for it to work

前端 未结 8 1845
温柔的废话
温柔的废话 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 04:53

    Sometime I had it problem when click on btn or txt or edt on the fragment, and realy helps use instead .setOnClickListener() need .setOnTouchListener like this example:

    txtClose.setOnTouchListener((v, event) -> {
                    // do staff...
                    return false;
                });
    

提交回复
热议问题