How to use ProgressBar material design on pre-installed Lollipop devices?

The progress bar of the material design looks cool, but I can’t use it on the pre-installed Lollipop devices. Does anyone know how to do this?

+5
source share
1 answer

I'm late, this is how you can do this.

Do this in your dropdown folder, create a progress_animator file with the contents:

 <?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> 

In your layout, now you need to add to the ProgressBar as undefined progress:

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

All Articles