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

前端 未结 6 1041
栀梦
栀梦 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:43

    Since button extends textview. You may use the methods in textview such as .setTextColor() or .setBackgroundColor() .

    Now for the the display you have 2 options:

    • AlertDialog - displays an alert but doesn't self close unless specified.
    • Toast - displays a text over a given time and self closes.

    take your pick.

提交回复
热议问题