Custom Button creation with multiple functionalities

from the CommonsWare Community archives

At June 4, 2019, 8:33am, Pvr asked:

I want to know how to create “Custom Button” with multiple functionalities ( Disable, focused…) in android .
Could you tell the process

At June 4, 2019, 10:46am, mmurphy replied:

“Disabled” and “focused” are two states of a StateListDrawable. A StateListDrawable is often used as the background for widgets, including buttons. I have a section on StateListDrawable in The Busy Coder’s Guide to Android Development.

Beyond that, being disabled or being focused are part of the standard View framework; a custom Button should not need to do anything other than provide the StateListDrawable background, IIRC.