title: Android Progress bar set level
body: <p>I am trying to change the progress bar color based on different levels. </p>
  
  <p>Drawable used by the progress bar</p>
  
  <pre><code>&lt;layer-list xmlns:android="http://schemas.android.com/apk/res/android"&gt;
  
      &lt;item android:maxLevel="1" android:drawable="@drawable/progress_horizontal_green"/&gt;
      &lt;item android:maxLevel="2" android:drawable="@drawable/progress_horizontal_red"/&gt;
  
  &lt;/layer-list&gt;
  </code></pre>
  
  <p>I am loading the progress bar like so:</p>
  
  <pre><code>// viewHolder.budgetProgress is a ProgressBar 
  viewHolder.budgetProgress.setMax(100);
  // No matter what level I change, the drawable used is always the lowest one.
  viewHolder.budgetProgress.getProgressDrawable().setLevel(0);
  viewHolder.budgetProgress.setProgress(95);
  </code></pre>
  
  <p>The problem is that the drawable used is always the lowest one, so in this case red. If I swap the <code>progress_horizontal_red</code> and <code>progress_horizontal_green</code> around, then the progress bar is always green.  </p>