作者:手机用户2502917905 | 来源:互联网 | 2024-12-20 12:44
我需要水平放置 4 个圆形进度条,如下所示:所以我决定使用新的材料组件循环进度指示器(https://material.io/components/progress-indicators/androi
我需要水平放置 4 个圆形进度条,如下所示:
所以我决定使用新的材料组件循环进度指示器(https://material.io/components/progress-indicators/android)。我在约束布局中将这 4 个进度条链接在一起,但它们不缩放。看起来他们仍然拥有默认的 24dp 尺寸。例如,即使我尝试将宽度和高度硬编码为 200dp,输出仍然是小进度条。
android:id="@+id/progressBarCalories"
android:layout_marginTop="32dp"
android:layout_marginStart="16dp"
android:layout_marginEnd="6dp"
android:layout_
android:layout_
app:layout_cOnstraintDimensionRatio="1:1"
app:layout_constraintHorizontal_chain
app:layout_constraintTop_toBottomOf="@id/wrapperCookingTime"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toStartOf="@id/progressBarProtein"
tools:progress="75"/>
android:id="@+id/progressBarProtein"
android:layout_marginTop="32dp"
android:layout_marginStart="6dp"
android:layout_marginEnd="6dp"
android:layout_
android:layout_
app:layout_cOnstraintDimensionRatio="1:1"
app:layout_constraintHorizontal_chain
app:layout_constraintTop_toBottomOf="@id/wrapperCookingTime"
app:layout_constraintStart_toEndOf="@id/progressBarCalories"
app:layout_constraintEnd_toStartOf="@id/progressBarCarbs"
tools:progress="75"/>
android:id="@+id/progressBarCarbs"
android:layout_marginTop="32dp"
android:layout_marginStart="6dp"
android:layout_marginEnd="6dp"
android:layout_
android:layout_
app:layout_cOnstraintDimensionRatio="1:1"
app:layout_constraintHorizontal_chain
app:layout_constraintTop_toBottomOf="@id/wrapperCookingTime"
app:layout_constraintStart_toEndOf="@id/progressBarProtein"
app:layout_constraintEnd_toStartOf="@id/progressBarFat"
tools:progress="75"/>
android:id="@+id/progressBarFat"
android:layout_marginTop="32dp"
android:layout_marginStart="6dp"
android:layout_marginEnd="16dp"
android:layout_
android:layout_
app:layout_cOnstraintDimensionRatio="1:1"
app:layout_constraintHorizontal_chain
app:layout_constraintTop_toBottomOf="@id/wrapperCookingTime"
app:layout_constraintStart_toEndOf="@id/progressBarCarbs"
app:layout_constraintEnd_toEndOf="parent"
tools:progress="75"/>
android:id="@+id/progressBar"
android:layout_marginTop="32dp"
app:layout_constraintWidth_min="200dp"
android:min
android:layout_
android:layout_
app:layout_constraintTop_toBottomOf="@id/progressBarFat"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
tools:progress="75"/>
回答
您必须使用该indicatorSize
属性:
android:indeterminate="true"
android:layout_
android:layout_
app:indicatorSize="90dp"
app:indicatorColor="@color/colorPrimary"
../>