Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/205.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 如何在预棒棒糖设备上使用Material design ProgressBar?_Android_Material Design - Fatal编程技术网

Android 如何在预棒棒糖设备上使用Material design ProgressBar?

Android 如何在预棒棒糖设备上使用Material design ProgressBar?,android,material-design,Android,Material Design,材质设计进度条看起来很酷,但我不能在棒棒糖前的设备上使用它。有人知道怎么做吗?我迟到了,这就是你能做到的 在可绘制文件夹中执行此操作,制作一个包含以下内容的文件progress\u animator: <?xml version="1.0" encoding="utf-8"?><!--<layer-list>--> <rotate xmlns:android="http://schemas.android.com/apk/res/android"

材质设计进度条看起来很酷,但我不能在棒棒糖前的设备上使用它。有人知道怎么做吗?

我迟到了,这就是你能做到的

在可绘制文件夹中执行此操作,制作一个包含以下内容的文件
progress\u animator

<?xml version="1.0" encoding="utf-8"?><!--<layer-list>-->
<rotate xmlns:android="http://schemas.android.com/apk/res/android"
    android:fromDegrees="0"
    android:toDegrees="1080">
    <layer-list>
        <item>
            <rotate xmlns:android="http://schemas.android.com/apk/res/android"
                android:fromDegrees="-90"
                android:toDegrees="-90">
                <shape
                    android:innerRadiusRatio="3.0"
                    android:shape="ring"
                    android:thickness="2.5dp"
                    android:useLevel="true">

                    <gradient
                        android:angle="0"
                        android:endColor="@color/colorAccent"
                        android:startColor="@color/colorAccent"
                        android:type="sweep"
                        android:useLevel="false" />
                </shape>
            </rotate>
        </item>

    </layer-list>
</rotate>

现在,在布局中,您必须将ProgressBar添加为不确定的可绘制进度:

<ProgressBar
    android:id="@+id/progressBarPreview"
    style="@style/Widget.AppCompat.ProgressBar"
    android:layout_width="wrap_content"
    android:layout_height="24dp"
    android:indeterminateDrawable="@drawable/progress_animator"
    /> 

我认为你必须用同样的颜色为进度条编写自己的风格