Button.setClickable(false) is not working

前端 未结 11 2260
無奈伤痛
無奈伤痛 2021-01-02 02:19

I have set mButton.setClickable(false); in my code but still this button is invoked by global button.setOnClickListener of my code.

EDIT:

11条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-01-02 03:06

    Instead of using setClickable(false) use following

    button.setFocusableInTouchMode(false);
    

    I had the same problem in my app where i needed to set my button not to clickable in certain conditions. this worked for me. Hope this helps.

提交回复
热议问题