title: Modify an xml StateListDrawable from java
body: <p>I have a drawable defined in res/drawable/my_background.xml.</p>
  
  <p>my_background.xml is:</p>
  
  <pre><code>&lt;selector xmlns:android="http://schemas.android.com/apk/res/android"&gt;
      &lt;item android:state_pressed="true"&gt;
          &lt;layer-list &gt;
              &lt;item android:drawable="@drawable/product_background_1" /&gt;
              &lt;item&gt;
                  &lt;rotate
                      android:fromDegrees="180"
                      android:toDegrees="180"
                      android:pivotX="50%"
                      android:pivotY="50%"
                      android:drawable="@drawable/product_background_2" 
                      android:id="@+id/need_to_change_this_color_from_java" /&gt;
              &lt;/item&gt;
              &lt;item&gt;&lt;color android:color="#4400aa00"/&gt;&lt;/item&gt;
          &lt;/layer-list&gt;
      &lt;/item&gt;
      &lt;item&gt;
          &lt;layer-list &gt;
              &lt;item android:drawable="@drawable/product_background_1" /&gt;
              &lt;item android:drawable="@drawable/product_background_2" /&gt;
          &lt;/layer-list&gt;
      &lt;/item&gt;
  &lt;/selector&gt;
  </code></pre>
  
  <p>I then set my_background as drawable on a view and that works fine. </p>
  
  <p>But I need to change the value of a color element which is stored in a layerList in my selector from my java code. How do I do that?</p>
  
  <p>I can call getBackground() on my view, and then get a StateListDrawable, but I can't find any method to get the drawable children from a StateListDrawable. </p>