Android Shape屬性創(chuàng)建環(huán)形進(jìn)度條
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)畫,并利用該旋轉(zhuǎn)動(dòng)畫自定義成一個(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ì)大家有所幫助,如果大家有任何疑問請(qǐng)給我留言,小編會(huì)及時(shí)回復(fù)大家的。在此也非常感謝大家對(duì)我們網(wǎng)站的支持!
如果你覺得本文對(duì)你有幫助,歡迎轉(zhuǎn)載,煩請(qǐng)注明出處,謝謝!
上一篇:Android實(shí)現(xiàn)美團(tuán)APP的底部滑動(dòng)菜單
欄 目:Android
下一篇:Android應(yīng)用禁止屏幕休眠的3種方法
本文標(biāo)題:Android Shape屬性創(chuàng)建環(huán)形進(jìn)度條
本文地址:http://mengdiqiu.com.cn/a1/Android/9026.html
您可能感興趣的文章
- 01-10Android自定義View之繪制圓形頭像功能
- 01-10Android實(shí)現(xiàn)雙擊返回鍵退出應(yīng)用實(shí)現(xiàn)方法詳解
- 01-10android實(shí)現(xiàn)記住用戶名和密碼以及自動(dòng)登錄
- 01-10android實(shí)現(xiàn)簡(jiǎn)單計(jì)算器功能
- 01-10Android 友盟第三方登錄與分享的實(shí)現(xiàn)代碼
- 01-10android實(shí)現(xiàn)指紋識(shí)別功能
- 01-10Emoji表情在Android JNI中的兼容性問題詳解
- 01-10Android實(shí)現(xiàn)圓形漸變加載進(jìn)度條
- 01-10android開發(fā)環(huán)境中SDK文件夾下的所需內(nèi)容詳解
- 01-10android異步消息機(jī)制 源碼層面徹底解析(1)


閱讀排行
- 1C語(yǔ)言 while語(yǔ)句的用法詳解
- 2java 實(shí)現(xiàn)簡(jiǎn)單圣誕樹的示例代碼(圣誕
- 3利用C語(yǔ)言實(shí)現(xiàn)“百馬百擔(dān)”問題方法
- 4C語(yǔ)言中計(jì)算正弦的相關(guān)函數(shù)總結(jié)
- 5c語(yǔ)言計(jì)算三角形面積代碼
- 6什么是 WSH(腳本宿主)的詳細(xì)解釋
- 7C++ 中隨機(jī)函數(shù)random函數(shù)的使用方法
- 8正則表達(dá)式匹配各種特殊字符
- 9C語(yǔ)言十進(jìn)制轉(zhuǎn)二進(jìn)制代碼實(shí)例
- 10C語(yǔ)言查找數(shù)組里數(shù)字重復(fù)次數(shù)的方法
本欄相關(guān)
- 01-10Android自定義View之繪制圓形頭像功能
- 01-10Android實(shí)現(xiàn)雙擊返回鍵退出應(yīng)用實(shí)現(xiàn)方
- 01-10android實(shí)現(xiàn)簡(jiǎn)單計(jì)算器功能
- 01-10android實(shí)現(xiàn)記住用戶名和密碼以及自動(dòng)
- 01-10C++自定義API函數(shù)實(shí)現(xiàn)大數(shù)相乘算法
- 01-10Android 友盟第三方登錄與分享的實(shí)現(xiàn)代
- 01-10android實(shí)現(xiàn)指紋識(shí)別功能
- 01-10如何給Flutter界面切換實(shí)現(xiàn)點(diǎn)特效
- 01-10Android實(shí)現(xiàn)圓形漸變加載進(jìn)度條
- 01-10Emoji表情在Android JNI中的兼容性問題詳
隨機(jī)閱讀
- 08-05DEDE織夢(mèng)data目錄下的sessions文件夾有什
- 04-02jquery與jsp,用jquery
- 01-10使用C語(yǔ)言求解撲克牌的順子及n個(gè)骰子
- 08-05織夢(mèng)dedecms什么時(shí)候用欄目交叉功能?
- 08-05dedecms(織夢(mèng))副欄目數(shù)量限制代碼修改
- 01-10delphi制作wav文件的方法
- 01-11ajax實(shí)現(xiàn)頁(yè)面的局部加載
- 01-11Mac OSX 打開原生自帶讀寫NTFS功能(圖文
- 01-10C#中split用法實(shí)例總結(jié)
- 01-10SublimeText編譯C開發(fā)環(huán)境設(shè)置