title: Multi color progress bar Android
body: <p>I know that this question has been asked but i could not figure out my problem.
  I want to create a progress bar which will have three colors during the progress.
  It will starts with blue, after 40% of progress it will smoothly turns to orange and after 75% it will turns smoothly to red.</p>
  
  <p>I have a drawable for the background and a single color for the progress: </p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;layer-list xmlns:android="http://schemas.android.com/apk/res/android"&gt;
  &lt;item android:id="@+id/background"&gt;
      &lt;shape&gt;
          &lt;gradient
              android:startColor="#666666"
              android:centerColor="#808080"
              android:endColor="#999999"
              android:centerY="1.0"
              android:angle="270"/&gt;
          &lt;corners android:radius="10dip"/&gt;
      &lt;/shape&gt;
  &lt;/item&gt;
  
  &lt;item android:id="@+id/progress"&gt;
      &lt;clip&gt;
          &lt;shape&gt;
              &lt;corners android:radius="10dip"/&gt;
              &lt;gradient
                  android:startColor="#0099e6"
                  android:centerY="0.75"
                  android:angle="270" /&gt;
          &lt;/shape&gt;
      &lt;/clip&gt;
  &lt;/item&gt;
  &lt;/layer-list&gt;
  </code></pre>
  
  <p>I create my progress bar dynamically:</p>
  
  <pre><code>    Drawable drawable = getResources().getDrawable(R.drawable.progressbar_style);
      progressBar.setProgressDrawable(drawable);
      progressBar.setMax(100);
  
      new Thread(new Runnable() {
          @Override
          public void run() {
              while (progressStatus &lt; 60){
                  mHandler.post(new Runnable() {
                      @Override
                      public void run() {
                          progressBar.setProgress(progressStatus);
                      }
                  });
                  try{
                      Thread.sleep(20);
                  }catch (InterruptedException e){
                      e.printStackTrace();
                  }
                  progressStatus++;
              }
          }
      }).start();
  </code></pre>