Home > database >  Why does my Android ProgressBar apparently ignore some xml attributes when inflated?
Why does my Android ProgressBar apparently ignore some xml attributes when inflated?

Time:12-23

I'm trying to create a determinate circular ProgressBar. My layout.xml says:

<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
…
    <ProgressBar
        android:id="@ id/progressBar2"
        style="?android:attr/progressBarStyle"
        android:layout_width="80dp"
        android:layout_height="80dp"
        android:layout_marginStart="16dp"
        android:layout_marginTop="16dp"
        android:indeterminate="false"
        android:progressTint="#ffff0000"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent" />

but it still shows up as indeterminate. (And green… but the green may be because it's indeterminate, since I'm only setting progressTint not indeterminateTint?)

What am I doing wrong?

CodePudding user response:

Try this : example of a determinate circular progress indicator

 <com.google.android.material.progressindicator.CircularProgressIndicator
  android:layout_width="wrap_content"
  android:layout_height="wrap_content"
  android:progress="75"
  app:indicatorColor="#FF0000"
  app:indicatorSize="100dp"
  app:trackColor="#D3D3D3"
  app:trackThickness="10dp" />

enter image description here

  • Related