Button.setClickable(false) is not working

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

    Set the click listener to null

    someView.setOnClickListener(null)

    As @Jan notes, the setOnClickListener enables the click listener automatically. Therefore, a null click listener can be set to disable future clicks. After setting the view to a null click listener, there are no adverse effects to future clicks on that view.

提交回复
热议问题