title: Show custom progressbar in android
body: <p>I want to show a custom progress-bar, which represents the battery charged status like 25%, 50% etc and that should look like as follows...Please help me thanks in advance</p>
  
  <p><img src="https://i.stack.imgur.com/0cyGh.png" alt="enter image description here"></p>
  
  <p>I have tried the following coding..</p>
  
  <p>drawable/custom_progressbar.xml is as follows..</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 android:shape="rectangle" &gt;
          &lt;corners android:radius="25dip" /&gt;
  
          &lt;gradient
              android:centerColor="@android:color/black"
              android:endColor="@android:color/black"
              android:gradientRadius="200"
              android:startColor="@android:color/black"
              android:type="radial" /&gt;
      &lt;/shape&gt;
  &lt;/item&gt;
  
  &lt;item android:id="@android:id/secondaryProgress"&gt;
  &lt;clip&gt;
      &lt;shape&gt;
          &lt;corners android:radius="25dip" /&gt;
          &lt;gradient
                  android:startColor="@android:color/white"
                  android:centerColor="@android:color/white"
                  android:centerY="0.75"
                  android:endColor="@android:color/white"
                  android:angle="270"
          /&gt;
      &lt;/shape&gt;
  &lt;/clip&gt;
  </code></pre>
  
  <p></p>
  
  <p>Then used the above progressbar as follows in my battery_status.xml as follows..</p>
  
  <pre><code> &lt;ProgressBar android:id="@+id/battery_pb"
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content"
                  android:layout_gravity="center"
                  android:minWidth="262dip"
                  android:minHeight="100dip"
                  android:max="100"
                  android:layout_marginLeft="0dip"
                  android:layout_marginRight="21dp"
                  style="?android:attr/progressBarStyleHorizontal"
                  android:progressDrawable="@drawable/custom_progressbar"/&gt; 
  </code></pre>
  
  <p>But I didn't get the way how I want my progressbar so please help me..</p>