I have many custom buttons (ToggleButton) in my application and you want to apply different styles for each button. I have created a selector for all buttons, and currently I am only changing the button to select, for example:
<?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:state_checked="true" android:drawable="@drawable/button_gradient_selected" /> <item android:drawable="@drawable/button_gradient" /> </selector>
When I try to change the style in the same way:
<item android:state_checked="true" android:drawable="@drawable/button_gradient_selected" style="@style/button_checked />
This will not work, I tried to change the style in the style instead (and just specified the style in the selector), I also tried to create a separate selector, but nothing works.
Any ideas?
source share