欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

Android Shape屬性創(chuàng)建環(huán)形進(jìn)度條

 更新時(shí)間:2019年11月29日 10:40:34   作者:Cricket_小帥  
這篇文章主要介紹了Android Shape屬性創(chuàng)建環(huán)形進(jìn)度條的實(shí)例代碼,代碼簡(jiǎn)單易懂,非常不錯(cuò),具有一定的參考借鑒價(jià)值,需要的朋友可以參考下

1,實(shí)現(xiàn)效果 

   

 2,實(shí)現(xiàn)代碼:
【1】 shape_drawable.xml 文件

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
  android:innerRadius="20dp"
  android:shape="ring"
  android:thickness="8dp"
  android:useLevel="false" >

  <gradient android:angle="0"
    android:startColor="@color/normal"
    android:centerColor="#5027844F"
    android:endColor="#fff"
    android:useLevel="false"
    android:type="sweep"
    />
</shape>

 【2】 我們將該自定義環(huán)形圈設(shè)置給一個(gè)旋轉(zhuǎn)動(dòng)畫(huà),并利用該旋轉(zhuǎn)動(dòng)畫(huà)自定義成一個(gè)環(huán)形進(jìn)度圈的style,最后將該自定義的style賦值給Progress組件。
progress_rotate文件

<?xml version="1.0" encoding="utf-8"?>
<rotate xmlns:android="http://schemas.android.com/apk/res/android"
  android:drawable="@drawable/shape_drawable"
  android:pivotX="50%"
  android:pivotY="50%"
  android:fromDegrees="0"
  android:toDegrees="360"
  >
</rotate>

 【3】 自定義Progress的style:
CustomProgressStyle文件

<style name="CustomProgressStyle" >
  <item name="android:indeterminateDrawable">@drawable/progress_rotate</item>
  <item name="android:minWidth">72dp</item>
  <item name="android:maxWidth">72dp</item>
  <item name="android:minHeight">72dp</item>
  <item name="android:maxHeight">72dp</item>
</style> 

【4】 應(yīng)用到Progress組件

<ProgressBar
   android:layout_width="100dp"
   android:layout_height="100dp"
   android:layout_centerInParent="true"
   style="@style/CustomProgressStyle"
   android:indeterminateDuration="700"
   />

總結(jié)

以上所述是小編給大家介紹的Android Shape屬性創(chuàng)建環(huán)形進(jìn)度條,希望對(duì)大家有所幫助,如果大家有任何疑問(wèn)請(qǐng)給我留言,小編會(huì)及時(shí)回復(fù)大家的。在此也非常感謝大家對(duì)腳本之家網(wǎng)站的支持!
如果你覺(jué)得本文對(duì)你有幫助,歡迎轉(zhuǎn)載,煩請(qǐng)注明出處,謝謝!

相關(guān)文章

最新評(píng)論