最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

Android?實(shí)現(xiàn)自定義圓形進(jìn)度條的三種常用方法

 更新時(shí)間:2023年03月01日 08:21:09   作者:jacklicto  
這篇文章主要介紹了Android?實(shí)現(xiàn)自定義圓形進(jìn)度條的三種常用方法的相關(guān)資料,需要的朋友可以參考下

Android 自定義 進(jìn)度條,一般有三種方式,最早一般使用UI給的圖片使用幀動(dòng)畫,完成,后面兩種,一種是使用自定義顏色,另外一種是使用帶相近色的圖片加動(dòng)畫完成。

下面具體 說一下三種方式,推薦使用第二種方式,如果這種達(dá)不到效果,或者比較高也可使用第一種方式;

一、通過幀動(dòng)畫實(shí)現(xiàn)

1.首先在res 下新建設(shè) anim 文件夾,在里面新建XML 文件;

定義res/anim/loading.xml如下:

例:loading.xml

<?xml version="1.0" encoding="UTF-8"?>
<animation-list android:oneshot="false"
xmlns:android="http://schemas.android.com/apk/res/android">

<item android:duration="150" android:drawable="@drawable/pic1" />

<item android:duration="150" android:drawable="@drawable/pic2" />
<item android:duration="150" android:drawable="@drawable/pic3" />
<item android:duration="150" android:drawable="@drawable/pic4" />
<item android:duration="150" android:drawable="@drawable/pic5" />
<item android:duration="150" android:drawable="@drawable/pic6" />
<item android:duration="150" android:drawable="@drawable/pic7"

<item android:duration="150" android:drawable="@drawable/pic8"/>

</animation-list>

二、通過自定義顏色實(shí)現(xiàn)

定義res/drawable/progress_color.xml如下:

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

<shape
android:innerRadiusRatio="3"
android:shape="ring"
android:thicknessRatio="8"
android:useLevel="false" >
<gradient
android:centerColor="#FFDC35"
android:centerY="0.50"
android:endColor="#CE0000"
android:startColor="#FFFFFF"
android:type="sweep"
android:useLevel="false" />
</shape>

</rotate>

第三種 使用有進(jìn)度的UI圖片:

定義res/drawable/progress_pic.xml如下:

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

在Activity 布局中直接使用就可以:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context="com.example.demo.MainActivity" >

<ProgressBar
android:id="@+id/loading_process_dialog_progressBar"
android:layout_width="150dp"
android:layout_height="150dp"
android:layout_gravity="center_horizontal"
android:indeterminate="false"
android:indeterminateDrawable="@anim/loading" />

<ProgressBar
style="?android:attr/progressBarStyleSmall"
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_marginTop="60dp"
android:layout_gravity="center_horizontal"
android:layout_centerInParent="true"
android:indeterminateDrawable="@drawable/progress_small" />

<ProgressBar
android:id="@+id/loading_process_pic"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="60dp"
android:indeterminate="false"
android:indeterminateDrawable="@drawable/progress_pic" />

</LinearLayout>

到此這篇關(guān)于Android 實(shí)現(xiàn)自定義圓形進(jìn)度條的三種常用方法的文章就介紹到這了,更多相關(guān)Android 實(shí)現(xiàn)自定義圓形進(jìn)度條內(nèi)容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!

相關(guān)文章

最新評(píng)論

霍山县| 沙田区| 高清| 宝山区| 正安县| 黄平县| 兴仁县| 阳春市| 常山县| 荔浦县| 阿拉善盟| 长岛县| 当阳市| 兴宁市| 德安县| 丹寨县| 镶黄旗| 仙游县| 电白县| 淳化县| 普格县| 珲春市| 白玉县| 贡觉县| 沙雅县| 长岭县| 运城市| 天水市| 广河县| 元阳县| 十堰市| 页游| 兴隆县| 休宁县| 曲阳县| 图们市| 香港 | 太保市| 枣阳市| 米泉市| 金沙县|