Search code examples
androidprogress-barheight

Is it possible to increase the height of the line inside the progress bar Android


Is it possible to increase the height of the line inside the progress bar ? enter image description here


Solution

  • I fixed it like this:

    I created a custom progress bar xml file inside drawable folder:

    progress_bar_states.xml:

        <layer-list xmlns:android="http://schemas.android.com/apk/res/android">
    
      <item android:id="@android:id/background">
        <shape>
          <corners android:radius="5dip" />
          <gradient
            android:startColor="@color/colorGray"
            android:centerColor="@color/colorGray"
            android:endColor="@color/colorGray"
          />
        </shape>
      </item>
    
    
    
      <item android:id="@android:id/progress">
        <clip>
          <shape>
            <corners android:radius="5dip" />
            <gradient
              android:startColor="@color/colorBlue"
              android:centerColor="@color/colorBlue"
              android:endColor="@color/colorBlue"
            />     
          </shape>
        </clip>
      </item>
    
    
    
    </layer-list>
    

    And in my layout:

                  <ProgressBar
                    style="?android:attr/progressBarStyleHorizontal"
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:indeterminateOnly="false"
                    android:id="@+id/progressBar"
                    android:gravity="left"
                    android:progressDrawable="@drawable/progress_bar_states"
                    android:layout_weight="1"
                    android:layout_marginBottom="10dp"
                    android:layout_marginLeft="15dp" />