gpt4 book ai didi

android - 圆形进度指示器忽略宽度/高度属性并且不缩放

转载 作者:行者123 更新时间:2023-12-03 21:43:51 25 4
gpt4 key购买 nike

我需要水平放置 4 个圆形进度条,如下所示:
enter image description here
所以我决定使用新的 Material 组件循环进度指示器(https://material.io/components/progress-indicators/android)。我传播链这4个进度条
在约束布局中,但它们不会缩放。看起来他们仍然有默认的 24dp 大小。例如,即使我尝试将宽度和高度硬编码为 200dp,输出仍然是小的进度条。

<com.google.android.material.progressindicator.CircularProgressIndicator
android:id="@+id/progressBarCalories"
style="@style/ProgressBarCircular"
android:layout_marginTop="32dp"
android:layout_marginStart="16dp"
android:layout_marginEnd="6dp"
android:layout_width="0dp"
android:layout_height="0dp"
app:layout_constraintDimensionRatio="1:1"
app:layout_constraintHorizontal_chainStyle="spread"
app:layout_constraintTop_toBottomOf="@id/wrapperCookingTime"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toStartOf="@id/progressBarProtein"
tools:progress="75"/>

<com.google.android.material.progressindicator.CircularProgressIndicator
android:id="@+id/progressBarProtein"
style="@style/ProgressBarCircular"
android:layout_marginTop="32dp"
android:layout_marginStart="6dp"
android:layout_marginEnd="6dp"
android:layout_width="0dp"
android:layout_height="0dp"
app:layout_constraintDimensionRatio="1:1"
app:layout_constraintHorizontal_chainStyle="spread"
app:layout_constraintTop_toBottomOf="@id/wrapperCookingTime"
app:layout_constraintStart_toEndOf="@id/progressBarCalories"
app:layout_constraintEnd_toStartOf="@id/progressBarCarbs"
tools:progress="75"/>

<com.google.android.material.progressindicator.CircularProgressIndicator
android:id="@+id/progressBarCarbs"
style="@style/ProgressBarCircular"
android:layout_marginTop="32dp"
android:layout_marginStart="6dp"
android:layout_marginEnd="6dp"
android:layout_width="0dp"
android:layout_height="0dp"
app:layout_constraintDimensionRatio="1:1"
app:layout_constraintHorizontal_chainStyle="spread"
app:layout_constraintTop_toBottomOf="@id/wrapperCookingTime"
app:layout_constraintStart_toEndOf="@id/progressBarProtein"
app:layout_constraintEnd_toStartOf="@id/progressBarFat"
tools:progress="75"/>

<com.google.android.material.progressindicator.CircularProgressIndicator
android:id="@+id/progressBarFat"
style="@style/ProgressBarCircular"
android:layout_marginTop="32dp"
android:layout_marginStart="6dp"
android:layout_marginEnd="16dp"
android:layout_width="0dp"
android:layout_height="0dp"
app:layout_constraintDimensionRatio="1:1"
app:layout_constraintHorizontal_chainStyle="spread"
app:layout_constraintTop_toBottomOf="@id/wrapperCookingTime"
app:layout_constraintStart_toEndOf="@id/progressBarCarbs"
app:layout_constraintEnd_toEndOf="parent"
tools:progress="75"/>

<com.google.android.material.progressindicator.CircularProgressIndicator
android:id="@+id/progressBar"
style="@style/ProgressBarCircular"
android:layout_marginTop="32dp"
app:layout_constraintWidth_min="200dp"
android:minWidth="200dp"
android:layout_width="200dp"
android:layout_height="wrap_content"
app:layout_constraintTop_toBottomOf="@id/progressBarFat"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
tools:progress="75"/>
enter image description here

最佳答案

您必须使用 indicatorSize 属性:

   <com.google.android.material.progressindicator.CircularProgressIndicator
android:indeterminate="true"
android:layout_width="100dp"
android:layout_height="100dp"
app:indicatorSize="90dp"
app:indicatorColor="@color/colorPrimary"
../>
enter image description here

关于android - 圆形进度指示器忽略宽度/高度属性并且不缩放,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65871383/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com