Can I make a button appear disabled and still listen for clicks?

前端 未结 6 1044
栀梦
栀梦 2021-01-11 11:32

I\'d like to gray out a button so it appears disabled to the user, but still listen for clicks so that I can display a message to the user that explains why the button isn\'

6条回答
  •  不思量自难忘°
    2021-01-11 11:44

    You could also set the Button's style to look grayed out (for both pressed and non-pressed states), then setOnClickListener() as normal, but have the onClick() method give the message that it isn't clickable.

提交回复
热议问题