kyn*_*yno 5 android material-design
材料设计进度条看起来很酷,但我不能在Lollipop前设备上使用它.谁知道有办法做到这一点?
我迟到了,这就是你可以做到的。
progress_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>
Run Code Online (Sandbox Code Playgroud)
现在,您必须在布局中添加 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"
/>
Run Code Online (Sandbox Code Playgroud)