title: Change color of progress bar background in android
body: <p>I have a Progressbar, which look is defined in a xml file: </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="@android:id/background"&gt;
          &lt;shape&gt;
              &lt;corners  android:radius="@dimen/round_corners_elements" /&gt;
              &lt;solid android:color="@color/blue_50" /&gt;
  
              &lt;stroke android:width="1px" android:color="@color/light_gray" /&gt;
          &lt;/shape&gt;
      &lt;/item&gt;
  
      &lt;item android:id="@android:id/progress"&gt;
          &lt;clip android:clipOrientation="horizontal" android:gravity="left"&gt;
              &lt;shape&gt;
                  &lt;corners
                      android:radius="@dimen/round_corners_elements"
                     /&gt;
                  &lt;solid android:color="@color/signaling_color" /&gt;
                  &lt;stroke android:width="1px" android:color="@color/light_gray" /&gt;
              &lt;/shape&gt;
          &lt;/clip&gt;
      &lt;/item&gt;
  
  &lt;/layer-list&gt;
  </code></pre>
  
  <p>But as i need to change the background color (blue50) to any other color dynamically, i failed. Anyone got an idea how i can change it programmatically? The progress can stay as it is. The special thing about is, that progress bar has round corners, which is necessary. I tried several approaches, but none worked for me. </p>
  
  <blockquote>
    <p>setBackgroundTintList didn't worked as is only available >API21</p>
  </blockquote>
  
  <pre><code>int[][] states = new int[][] { new int[] { android.R.attr.background }, new int[] { -android.R.attr.process } };
  int[] colors = new int[] { Color.parseColor("#000000"), Color.BLACK };
  ColorStateList myList = new ColorStateList(states, colors);
  progressBar.setBackgroundTintList(myList);
  progressBar.setBackgroundTintMode(PorterDuff.Mode.SRC_OVER);
  </code></pre>
  
  <blockquote>
    <p>setBackgroundColor Also had no effect:</p>
  </blockquote>
  
  <pre><code> progressBar.setBackgroundColor(ContextCompat.getColor(this, R.color.white));
  </code></pre>
  
  <p>Anyone got an idea?</p>