I have a custom view called MyCheckButton that uses a panel as the background for a fancy button. I had to use a panel because it contains other views and it works really well. (I can't change back to using a Button, ToggleButton or anything like that. It has to be a panel.)
I want to add StateListDrawable to the MyCheckButton panel so it has different colors when Pressed, Disabled etc. That works fine.
Here's the problem. The button also has a Checked property so I would also like to add a color for State_Checked. But how do I notify Android that the panel is now Checked so it will use the State_Checked color? I have a property MyCheckButton.Checked, but how do I notify the Android OS that the panel is now in the Checked state so it will do the coloring for me? The way I've been doing it up until now is to manually redraw the button color in the setChecked method. I thought if I could use StateListDrawable it would simplify things.
Any ideas on how to set the panel to a Checked state that is recognized by Android?
TIA
I want to add StateListDrawable to the MyCheckButton panel so it has different colors when Pressed, Disabled etc. That works fine.
Here's the problem. The button also has a Checked property so I would also like to add a color for State_Checked. But how do I notify Android that the panel is now Checked so it will use the State_Checked color? I have a property MyCheckButton.Checked, but how do I notify the Android OS that the panel is now in the Checked state so it will do the coloring for me? The way I've been doing it up until now is to manually redraw the button color in the setChecked method. I thought if I could use StateListDrawable it would simplify things.
Any ideas on how to set the panel to a Checked state that is recognized by Android?
TIA