Android progress bar indeterminatedrawable not filling in the progress bar
<p>I'm trying to write an indeterminate progress bar which fills the width of the parent on Android. When I ran my app the animation only covers the tiny center part of the progress bar. Can anyone here help me out?
Activity layout XML:</p>

<pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    tools:context="com.company.MainActivity"&gt;

    &lt;ProgressBar
        style="?android:attr/progressBarStyleHorizontal"
        android:layout_width="fill_parent"
        android:layout_height="5dp"
        android:id="@+id/loadingBar"
        android:layout_alignParentLeft="true"
        android:layout_alignParentStart="true"
        android:layout_alignParentRight="false"
        android:layout_alignParentEnd="false"
        android:padding="0dp"
        android:max="100"
        android:progress="0"
        android:visibility="visible"
        android:layout_centerHorizontal="false"
        android:layout_alignParentTop="true"
        android:indeterminateDrawable="@drawable/progressbar_drawable"
        android:layout_marginTop="0dp"
        android:indeterminateOnly="true"
        android:maxHeight="5dp"
        android:minHeight="5dp"
        android:indeterminateBehavior="cycle"
        android:indeterminate="true"
        android:paddingEnd="0dp"
        android:paddingStart="0dp"
        android:foregroundGravity="fill" /&gt;
&lt;/RelativeLayout&gt;
</code></pre>

<p>Progress bar drawable XML:</p>

<pre><code>&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;gradient
                android:angle="270"
                android:centerColor="#ff5a5d5a"
                android:centerY="0.5"
                android:endColor="#ffaa0000"
                android:startColor="#ff9d9e9d" /&gt;
        &lt;/shape&gt;
    &lt;/item&gt;
    &lt;item android:id="@android:id/progress"&gt;
        &lt;clip&gt;
            &lt;shape&gt;
                &lt;gradient
                    android:angle="0"
                    android:endColor="#ff009900"
                    android:startColor="#ff000099" /&gt;
            &lt;/shape&gt;
        &lt;/clip&gt;
    &lt;/item&gt;
&lt;/layer-list&gt;
</code></pre>

<p>When I ran my app, the animation only covers the tiny center part of the container. I set the background of the progress bar to non-white. I can see that the progress bar filled the width of the parent view.</p>