Custom button creation with multiple background states
from the CommonsWare Community archivesAt June 10, 2019, 4:47pm, Ven asked:
I have created XML files (focus, enable, disable, press) using Statelist drawable for my custom button but I have few queries…
- How button code gets differed from Custom button in XML .
- I want to know whole procedure ( steps to write XML & Java code) for creating custom button with multiple background states .
At June 10, 2019, 4:47pm, mmurphy replied:
Other than applying a StateListDrawable
to a Button
, I have not done anything more with respect to creating some sort of custom multi-state button implementation. You might look at the source code to CompoundButton
to get some ideas (and, depending on your needs, CompoundButton
might be the right base class to use).