title: Changing gradient background colors on Android at runtime
body: <p>I'm experimenting with Drawable backgrounds and have had no problems so far.</p>
  
  <p>I'm now trying to change the gradient background color at runtime.</p>
  
  <p>Unfortunately, there's no API to change it at runtime, it seems. Not even by trying to mutate() the drawable, as explained here: <a href="http://android-developers.blogspot.com/2009/05/drawable-mutations.html" rel="noreferrer">Drawable mutations</a></p>
  
  <p>The sample XML looks like this. It works, as expected.</p>
  
  <pre><code>&lt;shape xmlns:android="http://schemas.android.com/apk/res/android"
      android:shape="rectangle"&gt;
      &lt;gradient
          android:startColor="#330000FF"
          android:endColor="#110000FF"
          android:angle="90"/&gt;
  &lt;/shape&gt;
  </code></pre>
  
  <p>Sadly, I want a list with various colors, and they'd have to be programatically altered at runtime.</p>
  
  <p>Is there another way to create this gradient background at runtime? Perhaps even not using XML altogether?</p>