Button.setClickable(false) is not working

前端 未结 11 2151
無奈伤痛
無奈伤痛 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:00

    Put setClickable after setOnClickListener

    mBtn.setOnClickListener(this);
    mBtn.setClickable(false);
    

    if you put setClickable(false) before setOnClickListener(this), it doesn't work.

提交回复
热议问题