RaJ
RaJ

Reputation: 1243

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

Upvotes: 11

Views: 15480

Answers (1)

Gabriele Mariotti
Gabriele Mariotti

Reputation: 364780

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

Upvotes: 20

Related Questions