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

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

    I am not an Android expert, so there could be better ways, but what about disabling the button and overlaying a transparent view that will catch the events?

    You could have the view always there laying below the button so you just need to change a z-index, or create it dynamically when needed.

提交回复
热议问题