Note that there are some explanatory texts on larger screens.

plurals
  1. POShadow color on buttons depending on state in XML - Android
    primarykey
    data
    text
    <p>I've created custom ToggleButtons in Android and since all buttons inherit from the same xml I want to change how they act depending on state, so when the state is checked I want to change the shadow color but this does not seem to possible with the current SDK.</p> <p>I've created an xml file which holds button_colors: </p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;selector xmlns:android="http://schemas.android.com/apk/res/android"&gt; &lt;item android:state_checked="true" android:color="#FFFFFF" /&gt; &lt;item android:color="#000000" /&gt; &lt;/selector&gt; </code></pre> <p>But this only seems to work with text-color and not shadow color on the text. Is there something I'm missing? And rather not do this for every button manually in code since I want this to apply to every button in the app.</p> <p><strong>UPDATE EDIT:</strong> </p> <p>My selector currently looks like this</p> <pre><code>&lt;selector xmlns:android="http://schemas.android.com/apk/res/android"&gt; &lt;item android:state_checked="true" android:drawable="@drawable/button_gradient_selected" /&gt; &lt;item android:drawable="@drawable/button_gradient" /&gt; &lt;/selector&gt; </code></pre> <p>But as I mentioned to the commentator below I can't seem to change the style/text-color-shadow from here since it only can take in a drawable it seems.</p> <p>When I try to put in a different style on the button in here it force closes or either does not change the style depending on state. When I only try to put in the style here and have the drawable be set in the style it force closes. Either way it does not work it seems.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload