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

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)畫(huà),完成,后面兩種,一種是使用自定義顏色,另外一種是使用帶相近色的圖片加動(dòng)畫(huà)完成。

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

一、通過(guò)幀動(dòng)畫(huà)實(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>

二、通過(guò)自定義顏色實(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)容請(qǐng)搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!

相關(guān)文章

  • Android仿微信通訊錄滑動(dòng)快速定位功能

    Android仿微信通訊錄滑動(dòng)快速定位功能

    這篇文章主要介紹了Android仿微信通訊錄滑動(dòng)快速定位功能,非常不錯(cuò),具有參考借鑒價(jià)值,需要的朋友可以參考下
    2017-03-03
  • Android圓角按鈕的制作方法

    Android圓角按鈕的制作方法

    這篇文章主要為大家詳細(xì)介紹了Android圓角按鈕的制作方法,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下
    2017-08-08
  • Android 圖片顯示與屏幕適配的問(wèn)題

    Android 圖片顯示與屏幕適配的問(wèn)題

    這篇文章主要介紹了Android 圖片顯示與屏幕適配的問(wèn)題的相關(guān)資料,Android的分辨率問(wèn)題是每個(gè)Android 開(kāi)發(fā)者頭疼的問(wèn)題,那么這里給大家介紹個(gè)萬(wàn)能辦法,需要的朋友可以參考下
    2017-08-08
  • Android直播app送禮物連擊動(dòng)畫(huà)效果(實(shí)例代碼)

    Android直播app送禮物連擊動(dòng)畫(huà)效果(實(shí)例代碼)

    最近在做公司的直播項(xiàng)目,需要實(shí)現(xiàn)一個(gè)觀看端連擊送禮物的控件,下面給大家分享實(shí)例代碼,需要的的朋友參考下吧
    2017-07-07
  • Android多返回棧技術(shù)

    Android多返回棧技術(shù)

    本文將詳情講解用戶通過(guò)系統(tǒng)返回按鈕導(dǎo)航回去的一組頁(yè)面,在開(kāi)發(fā)中被稱(chēng)為返回棧 (back stack)。多返回棧即一堆 "返回棧",對(duì)多返回棧的支持是在 Navigation 2.4.0-alpha01 和 Fragment 1.4.0-alpha01 中開(kāi)始的,有興趣的話一起參與學(xué)習(xí)
    2021-08-08
  • Android自定義view實(shí)現(xiàn)太極效果實(shí)例代碼

    Android自定義view實(shí)現(xiàn)太極效果實(shí)例代碼

    這篇文章主要介紹了Android自定義view實(shí)現(xiàn)太極效果實(shí)例代碼的相關(guān)資料,需要的朋友可以參考下
    2017-05-05
  • Android 實(shí)現(xiàn)加載大圖片的方法

    Android 實(shí)現(xiàn)加載大圖片的方法

    對(duì)于超大的圖片,如果不縮放的話,容易導(dǎo)致內(nèi)存溢出。而經(jīng)過(guò)處理后,無(wú)論多大的圖片,都能夠在手機(jī)屏幕上加載出來(lái),不會(huì)導(dǎo)致內(nèi)存溢出。本文將對(duì)Android 加載大圖片的實(shí)現(xiàn)方法進(jìn)行介紹,下面跟著小編一起來(lái)看下吧
    2017-04-04
  • 詳解Android?Flutter如何使用相機(jī)實(shí)現(xiàn)拍攝照片

    詳解Android?Flutter如何使用相機(jī)實(shí)現(xiàn)拍攝照片

    在app中使用相機(jī)肯定是再平常不過(guò)的一項(xiàng)事情了,相機(jī)肯定涉及到了底層原生代碼的調(diào)用,那么在flutter中如何快速簡(jiǎn)單的使用上相機(jī)的功能呢?一起來(lái)看看吧
    2023-04-04
  • anroid開(kāi)發(fā)教程之spinner下拉列表的使用示例

    anroid開(kāi)發(fā)教程之spinner下拉列表的使用示例

    這篇文章主要介紹了anroid的spinner下拉列表的使用示例,需要的朋友可以參考下
    2014-04-04
  • Android實(shí)現(xiàn)粒子爆炸效果的方法

    Android實(shí)現(xiàn)粒子爆炸效果的方法

    這篇文章主要介紹了Android實(shí)現(xiàn)粒子爆炸效果的方法,實(shí)例分析了Android動(dòng)畫(huà)特效的實(shí)現(xiàn)技巧,需要的朋友可以參考下
    2015-06-06

最新評(píng)論