title: Change the color of a seekbar on onProgressChanged
body: <p>I have custom  seekbar and I can change the the color in the onProgressChanged by setting a new progress drawable:</p>
  <pre><code>seek.setProgressDrawable(res.getDrawable(R.drawable.seekbar_bg1));
  </code></pre>
  <p>But I would like a seekbar which has a solid color from green to red depending on the progress.
  Is there a way to use something like a gradient color so I don't need to create like 100 drawables this?</p>
  <pre><code>    &lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
   &lt;layer-list xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;&gt;
  
   &lt;item android:id=&quot;@android:id/background&quot;&gt;
    &lt;shape&gt;
      &lt;solid android:color=&quot;@android:color/transparent&quot; /&gt;
    &lt;/shape&gt;
  &lt;/item&gt;
  
  &lt;item android:id=&quot;@+id/progressshape&quot;&gt;
  &lt;clip&gt;
    &lt;shape&gt;
      &lt;solid android:color=&quot;@color/custom_yellow&quot; /&gt;
    &lt;/shape&gt;
  &lt;/clip&gt;
  &lt;/item&gt;
  
  &lt;/layer-list&gt;
  </code></pre>
  <p><strong>For those who are interested in the solution. I use the following code:</strong></p>
  <p>this method to set the color:</p>
  <pre><code>public void setProgressBarColor(int newColor){ 
    LayerDrawable ld = (LayerDrawable) getProgressDrawable();
    ClipDrawable d1 = (ClipDrawable) ld.findDrawableByLayerId(R.id.progressshape);
    d1.setColorFilter(newColor, PorterDuff.Mode.SRC_IN);
  }
  </code></pre>
  <p>and in the onProgressChanged:</p>
  <pre><code> if(progress &lt;= 50){
                  seek.setProgressBarColor(Color.rgb( 255 - (255/100 * (100 - progress*2)), 255, 0));
   }else{
                  seek.setProgressBarColor(Color.rgb( 255, 255 - (255/100 * (progress - 50)*2), 0));
   }
  </code></pre>