Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use horizontal "material progressindicator" in android?

I've used "android.material.progressindicator" for the purpose of showing progress in horizontal view but I can't hear my XML

<com.google.android.material.progressindicator.ProgressIndicator
                android:background="@color/grey"
                android:id="@+id/progressInd"
                style="@style/Widget.MaterialComponents.ProgressIndicator.Linear.Determinate"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:indeterminate="false"
                android:max="100"
                android:progress="30"
                android:progressDrawable="@drawable/bidding_progress" />

enter image description here

like image 627
RaJ Avatar asked Mar 26 '26 12:03

RaJ


1 Answers

You can use:

<com.google.android.material.progressindicator.LinearProgressIndicator
    app:indicatorColor="?attr/colorPrimary"
    app:trackColor="@color/..."
    />

Use progressIndicator.setProgressCompat((int) value, true); to update the value in the indicator.

Use the attributes:

  • indicatorColor to se the color of the color of indicator
  • trackColor to set the color of track
  • trackThickness to set the height of the progress bar

enter image description here

Note: It requires at least the version 1.3.0-alpha04

like image 93
Gabriele Mariotti Avatar answered Mar 28 '26 00:03

Gabriele Mariotti



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!