2

I'm able to modify the height, width, and outer color of a ProgessBar widget. But that doesn't seem to affect the inner part of the bar. The red line that progresses. Is there a way to modify that? Or do I need to create a custom widget for that?

Thank you

enter image description here

Daniel Kaplan
  • 701
  • 7
  • 19

2 Answers2

0

You can use android:indeterminateTint="@color/green" in your xml.

You can also try setIndeterminateDrawable(drawable) or setIndeterminateTintList() (I didn't check this solution)

yotam ravits
  • 181
  • 10
0

You can increase the height of the progress indicator, it can be achieved by adding following parameter in your layout.xml for ProgressBar:

android:scaleY="5"

<ProgressBar
        android:id="@+id/progressBar"
        style="@style/Widget.AppCompat.ProgressBar.Horizontal"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:scaleY="5"
         />

If you want to reduce the padding around the indicator, then modify layout_height attribute as follows:

 <ProgressBar
            android:id="@+id/progressBar"
            style="@style/Widget.AppCompat.ProgressBar.Horizontal"
            android:layout_width="match_parent"
            android:layout_height="5dp" 
             />

You can use following on version older than Lollipop to change the indicator's color:

progressBar.getProgressDrawable().setColorFilter(
    Color.RED, android.graphics.PorterDuff.Mode.SRC_IN);

For Lollipop and above, use following:

progressBar.setProgressTintList(ColorStateList.valueOf(Color.RED));

You can refer to this SO for progressBar color

Sagar
  • 23,903
  • 4
  • 62
  • 62
  • Hello, The scale does work but it increases the entire bar (background and the progress indicator.) What if I wanted less background? Like just the progress bar? – Daniel Kaplan Apr 29 '18 at 23:26
  • You mean, you just want to increase the height of progress bar without impacting the indicator? – Sagar Apr 30 '18 at 00:13