Guest User

Circular Progress Bar

a guest
Apr 5th, 2016
215
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
XML 2.50 KB | None | 0 0
  1. <?xml version="1.0" encoding="utf-8"?>
  2. <layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
  3.  
  4.     <item android:id="@android:id/secondaryProgress">
  5.         <shape
  6.            android:innerRadiusRatio="8"
  7.            android:shape="ring"
  8.            android:useLevel="true"
  9.            android:thicknessRatio="20.0"
  10.            android:thickness="3.8sp">
  11.  
  12.             <gradient
  13.                android:startColor="@color/colorAccent"
  14.                android:endColor="@color/colorAccent"
  15.                android:centerColor="@color/colorAccent"
  16.                android:type="sweep" />
  17.  
  18.         </shape>
  19.     </item>
  20.  
  21.     <item android:id="@android:id/progress">
  22.  
  23.         <rotate
  24.            android:fromDegrees="270"
  25.            android:pivotX="50%"
  26.            android:pivotY="50%"
  27.            android:toDegrees="270" >
  28.  
  29.             <shape
  30.                android:innerRadiusRatio="8"
  31.                android:shape="ring"
  32.                android:useLevel="true"
  33.                android:thickness="3.8sp"
  34.                android:thicknessRatio="20.0">
  35.  
  36.                 <rotate
  37.                    android:fromDegrees="0"
  38.                    android:toDegrees="360"
  39.                    android:pivotX="50%"
  40.                    android:pivotY="50%" />
  41.  
  42.                 <gradient
  43.                    android:startColor="@color/colorPrimary"
  44.                    android:endColor="@color/colorPrimary"
  45.                    android:centerColor="@color/colorPrimary"
  46.                    android:type="sweep" />
  47.  
  48.             </shape>
  49.  
  50.         </rotate>
  51.     </item>
  52.  
  53. </layer-list>
  54.  
  55.  
  56.  
  57.  <ProgressBar
  58.                    android:id="@+id/nextOkeKeyProgressBar"
  59.                    android:layout_width="match_parent"
  60.                    android:layout_height="match_parent"
  61.                    android:layout_centerInParent="true"
  62.                    style="?android:attr/progressBarStyleHorizontal"
  63.                    android:clickable="false"
  64.                    android:indeterminate="false"
  65.                    android:max="30"
  66.                    android:progress="0"
  67.                    android:visibility="visible"
  68.                    android:progressDrawable="@drawable/circular_progress_bar"/>
  69.  
  70.  
  71.  
  72.  
  73.  
  74.  
  75. ObjectAnimator animation = ObjectAnimator.ofInt(findViewById(R.id.nextOkeKeyProgressBar), "progress", 0, 30);
  76.                     animation.setDuration(990);
  77.                     animation.setInterpolator(new DecelerateInterpolator());
  78.                     animation.start();
Add Comment
Please, Sign In to add comment