【问题标题】:Progressbar indeterminate drawable vs progressDrawableProgressbar indeterminate drawable vs progressDrawable
【发布时间】:2016-10-05 10:33:25
【问题描述】:

我需要创建微调循环进度条,它从底部开始循环(进度从 0 到最大值)到顶部,当到达顶部时开始最小化(进度最大值到 0),然后从底部再次声明。

这是我的进度条

<ProgressBar
        style="?android:attr/progressBarStyle"
        android:layout_width="70dp"
        android:layout_height="70dp"
        android:id="@+id/progressBar2"
        android:indeterminateDrawable="@drawable/progressbar_circle"
        android:progressTintMode="src_atop"
        android:layout_centerInParent="true"
        android:indeterminateDuration="500"
        android:layout_marginTop="189dp"
        android:indeterminateOnly="true"
        />

这是可绘制的progressbar_circle.xml

<?xml version="1.0" encoding="utf-8"?>
<rotate xmlns:android="http://schemas.android.com/apk/res/android"
    android:pivotX="50%" android:pivotY="50%" android:fromDegrees="90"
    android:toDegrees="270">
    <shape android:shape="ring"
        android:thicknessRatio="13" android:useLevel="false">

        <size android:width="76dip" android:height="76dip" />
        <gradient android:type="sweep" android:useLevel="false"
            android:centerColor="#000cbdfb"
            android:endColor="#f168c1"
            android:angle="0"
            />
    </shape>
</rotate>

在我的进度条中,我将 drawable 指定为 indeterminateDrawable。它只是从下到上循环并立即从底部开始(在顶部开始最小化时我无法达到效果)。

【问题讨论】:

    标签: android android-drawable android-progressbar


    【解决方案1】:

    像这样更改您的 rotate 可绘制参数

    android:fromDegrees="90"
    android:toDegrees="450"
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2011-11-20
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-02-18
      • 1970-01-01
      相关资源
      最近更新 更多