1. 程式人生 > >【FastDev4Android框架開發】非常漂亮的進度指示器AVLoadingIndicatorView的使用講解(十八)

【FastDev4Android框架開發】非常漂亮的進度指示器AVLoadingIndicatorView的使用講解(十八)

轉載請標明出處: 

().前言:   

       【好訊息】個人網站已經上線執行,後面部落格以及技術乾貨等精彩文章會同步更新,請大家關注收藏:http://www.lcode.org

      今天我們的專案繼續更新,今天主要要加入一個非常漂亮的進度指示器AVLoadingIndicatorView(開源地址)效果很不錯,用起來非常簡單和平時ProgressBar一樣簡單。效果如下:

().簡要介紹:   

AVLoadingIndicatorView是一個Android平臺進度動畫的集合框架,我們可以非常簡單的配置和使用動畫。

().使用方式

      3.1.AndroidStudio框架引入配置

:build.grade配置

 dependencies {
       compile 'com.wang.avi:library:1.0.0'
       compile'com.nineoldandroids:library:2.4.0'
    }
    3.2.佈局引入載入控制元件
<?xmlversion="1.0" encoding="utf-8"?>
<LinearLayoutxmlns:android="http://schemas.android.com/apk/res/android"
   xmlns:app="http://schemas.android.com/apk/res-auto"
    android:orientation="vertical"android:layout_width="match_parent"
   android:layout_height="match_parent">
    <LinearLayout
       android:layout_width="fill_parent"
        android:layout_height="49dp"
        android:background="#e7abff"
        android:gravity="center"
        >
        <TextView
           android:layout_width="wrap_content"
           android:layout_height="wrap_content"
           android:layout_centerInParent="true"
           android:textColor="@color/white"
           android:text="進度動畫例項"/>
    </LinearLayout>
    <ScrollView
       android:layout_width="fill_parent"
       android:layout_height="fill_parent">
        <LinearLayout
           android:layout_width="fill_parent"
           android:layout_height="fill_parent"
           android:orientation="vertical">
            <!--BallPulse-->
            <LinearLayout
               android:layout_width="fill_parent"
               android:layout_height="wrap_content"
               android:orientation="horizontal">
                <TextView
                   android:layout_width="wrap_content"
                   android:layout_height="wrap_content"
                   android:layout_centerInParent="true"
                   android:textColor="@color/black"
                   android:text="BallPulse:"/>
               <com.wang.avi.AVLoadingIndicatorView
                   android:id="@+id/avloadingIndicatorView_BallPulse"
                   android:layout_width="wrap_content"
                   android:layout_height="wrap_content"
                   android:visibility="visible"
                   app:indicator="BallPulse"
                   app:indicator_color="@color/red"
                    />
            </LinearLayout>
            <!--BallGridPulse-->
            <LinearLayout
               android:layout_width="fill_parent"
               android:layout_height="wrap_content"
               android:orientation="horizontal">
                <TextView
                   android:layout_width="wrap_content"
                   android:layout_height="wrap_content"
                   android:layout_centerInParent="true"
                   android:textColor="@color/black"
                   android:text="BallGridPulse:"/>
               <com.wang.avi.AVLoadingIndicatorView
                   android:id="@+id/avloadingIndicatorView_BallGridPulse"
                   android:layout_width="wrap_content"
                   android:layout_height="wrap_content"
                   android:visibility="visible"
                   app:indicator="BallGridPulse"
                   app:indicator_color="@color/red"
                    />
            </LinearLayout>
 
            <!--BallClipRotate-->
            <LinearLayout
               android:layout_width="fill_parent"
               android:layout_height="wrap_content"
               android:orientation="horizontal">
                <TextView
                   android:layout_width="wrap_content"
                   android:layout_height="wrap_content"
                   android:layout_centerInParent="true"
                   android:textColor="@color/black"
                   android:text="BallGridPulse:"/>
               <com.wang.avi.AVLoadingIndicatorView
                   android:id="@+id/avloadingIndicatorView_BallClipRotate"
                   android:layout_width="wrap_content"
                   android:layout_height="wrap_content"
                   android:visibility="visible"
                   app:indicator="BallClipRotate"
                   app:indicator_color="@color/red"
                    />
            </LinearLayout>
            <!--BallClipRotatePulse-->
            <LinearLayout
               android:layout_width="fill_parent"
               android:layout_height="wrap_content"
               android:orientation="horizontal">
                <TextView
                   android:layout_width="wrap_content"
                   android:layout_height="wrap_content"
                   android:layout_centerInParent="true"
                   android:textColor="@color/black"
                   android:text="BallClipRotatePulse:"/>
               <com.wang.avi.AVLoadingIndicatorView
                   android:id="@+id/avloadingIndicatorView_BallClipRotatePulse"
                   android:layout_width="wrap_content"
                   android:layout_height="wrap_content"
                   android:visibility="visible"
                   app:indicator="BallClipRotatePulse"
                   app:indicator_color="@color/red"
                    />
            </LinearLayout>
 
            <Button
               android:id="@+id/progress_start"
               android:layout_width="wrap_content"
               android:layout_height="wrap_content"
               android:text="開啟動畫"/>
            <Button
               android:id="@+id/progress_stop"
               android:layout_width="wrap_content"
               android:layout_height="wrap_content"
               android:text="關閉動畫"/>
        </LinearLayout>
    </ScrollView>
</LinearLayout>

      3.3.手動控制佈局顯示和隱藏,具體Activity程式碼如下:

packagecom.chinaztt.fda.test;
importandroid.os.Bundle;
importandroid.view.View;
importandroid.widget.Button;
importcom.chinaztt.fda.ui.R;
importcom.chinaztt.fda.ui.base.BaseActivity;
importcom.wang.avi.AVLoadingIndicatorView;
importorg.androidannotations.annotations.EActivity;
 
/**
 * 當前類註釋:
 * 專案名:FastDev4Android
 * 包名:com.chinaztt.fda.test
 * 作者:江清清 on 15/11/3 08:37
 * 郵箱:
[email protected]
* QQ: 781931404 * 公司:江蘇中天科技軟體技術有限公司 */ @EActivity public classAVLoadingIndicatorActivity extends BaseActivity{ private Buttonprogress_start,progress_stop; private AVLoadingIndicatorViewavloadingIndicatorView_BallPulse; @Override protected void onCreate(BundlesavedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.av_loading_indicator_layout); avloadingIndicatorView_BallPulse=(AVLoadingIndicatorView)this.findViewById(R.id.avloadingIndicatorView_BallPulse); progress_start=(Button)this.findViewById(R.id.progress_start); progress_stop=(Button)this.findViewById(R.id.progress_stop); //開啟動畫 progress_start.setOnClickListener(newView.OnClickListener() { @Override public void onClick(View v) { avloadingIndicatorView_BallPulse.setVisibility(View.VISIBLE); } }); //關閉動畫 progress_stop.setOnClickListener(newView.OnClickListener() { @Override public void onClick(View v) { avloadingIndicatorView_BallPulse.setVisibility(View.GONE); } }); } }

        3.4.實現效果如下:


().官方可選動畫


上面為該庫提供的所有動畫的例項,下面對於每一個動畫的配置資訊做如下說明(以行為單位):

第一行:BallPulse,BallGridPulse,BallClipRotate,BallClipRotatePulse

第二行:SquareSpin,BallClipRotateMultiple,BallPulseRise,BallRotate

第三行:CubeTransition,BallZigZag,BallZigZagDeflect,BallTrianglePath

第四行:BallScale,LineScale,LineScaleParty,BallScaleMultiple

第五行:BallPulseSync,BallBeat,LineScalePulseOut,LineScalePulseOutRapid

第六行:BallScaleRipple,BallScaleRippleMultiple,BallSpinFadeLoader,LineSpinFadeLoader

第七行:TriangleSkewSpin,Pacman,BallGridBeat,SemiCircleSpin

         到此位置關於AVLoadingIndicatorView框架做出漂亮的ProgressBar,同時我們的專案已經配置該動畫集框架.歡迎大家去Github站點進行clone或者下載瀏覽:https://github.com/jiangqqlmj/FastDev4Android同時歡迎大家starfork整個開源快速開發框架專案~

關注我的訂閱號(codedev123),每天分享移動開發技術(Android/IOS),專案管理以及部落格文章!第一時間獲取推送文章!


關注我的微博,可以獲得更多精彩內容


相關推薦

FastDev4Android框架開發非常漂亮進度指示器AVLoadingIndicatorView的使用講解()

轉載請標明出處: (一).前言:          【好訊息】個人網站已經上線執行,後面部落格以及技術乾貨等精彩文章會同步更新,請大家關注收藏:http://www.lcode.org      今天我們的專案繼續更新,今天主要要加入一個非常漂亮的進度指示器AVLoading

FastDev4Android框架開發HorizontalScrollView,Fragment,FragmentStatePagerAdapter打造網易新聞Tab及滑動頁面效果(三六)

轉載請標明出處:(一).前言:            【好訊息】個人網站已經上線執行,後面部落格以及技術乾貨等精彩文章會同步更新,請大家關注收藏:http://www.lcode.org         仿36Kr客戶端開發過程中,因為他們網站上面的新聞文章分類比較多,所以我

FastDev4Android框架開發CardView完全解析與RecyclerView結合使用(三二)

轉載請標明出處:(一).前言:           【好訊息】個人網站已經上線執行,後面部落格以及技術乾貨等精彩文章會同步更新,請大家關注收藏:http://www.lcode.org作為Android L開始,Google更新的除了RecyclerView之外的另一控制元件

FastDev4Android框架開發重寫WebView網頁載入以及JavaScript注入詳解(二十三)

轉載請標明出處: (一).前言:            【好訊息】個人網站已經上線執行,後面部落格以及技術乾貨等精彩文章會同步更新,請大家關注收藏:http://www.lcode.org       今天我們來學習一下重寫WebView元件來實現網頁的載入,以及我們平時AP

FastDev4Android框架開發Volley完全解析之基礎使用(二六)

轉載請標明出處:(一).前言:             【好訊息】個人網站已經上線執行,後面部落格以及技術乾貨等精彩文章會同步更新,請大家關注收藏:http://www.lcode.org對於網路框架這

FastDev4Android框架開發訊息匯流排EventBus的基本使用(二)

轉載請標明出處: (一).前言:        【好訊息】個人網站已經上線執行,後面部落格以及技術乾貨等精彩文章會同步更新,請大家關注收藏:http://www.lcode.org      今天我們的

FastDev4Android框架開發AndroidAnnnotations注入框架使用之最佳實踐SharedPreferences(七)

轉載請標明出處:  (一).前言:    前面我們已經對於AndroidAnnotations使用Adapters和lists做了講解,今天我們開始具體學習一下使用DI框架SharedPrefe

FastDev4Android框架開發RecyclerView完全解析之打造新版類Gallery效果(二九)

轉載請標明出處:(一).前言:              【好訊息】個人網站已經上線執行,後面部落格以及技術乾貨等精彩文章會同步更新,請大家關注收藏:http://www.lcode.org         話說RecyclerView已經面市很久,也在很多應用中得到廣泛的使

React Native開發React Native控件之ProgressBarAndroid進度條解說(12)

ice 發現 來講 top 文章 func dev all ios 轉載請標明出處:http://blog.csdn.net/developer_jiangqq/article/details/50596367本文出自:【江清清的博客】(一)前言 【好消息】

大數據開發你知道大數據語言的工具與框架嗎?

新節點 java 學習曲線 定義 onf 團隊 工具 cal 儀表盤 為了解大數據的當前和未來狀態,我們采訪了來自28個組織的31位IT技術主管。我們問他們,“你在數據提取,分析和報告中使用的最流行的語言,工具和框架是什麽?” 以下的文章是他們告訴我們的記錄,經過總結如下。

iOS越獄開發怎樣將應用打包成.ipa文件

ria font 配置文件 例如 方法 col stat pack 應該 在項目開發中。我們經常須要將project文件打包成.ipa文件。提供給越獄的iphone安裝。 以下是一種方法: 1、首先應該給project安裝好配置文件(這裏不再敖述),在ios de

微信開發02.搭建一個屬於自己的微信公眾平臺

tro 投票 新浪 關系 blank 訂閱 logs name 開發者 閱讀目錄 【網站開發】在新浪SAE上搭建一個博客 概述   公司年會上同事開發了一個微信企業號,包含了投票,抽獎,祝福墻功能,還開了一個Session,跟我們講了下公司的企業號開發過程和抽獎中獎

Android 應用開發 ActionBar 樣式具體解釋 -- 樣式 主題 簡單介紹 Actionbar 的 icon logo 標題 菜單樣式改動

detail sub str 進度條 代碼分析 extc dst 模式 html 作者 : 萬境絕塵 ([email protected]/* */)轉載請著名出處 : http://blog.csdn.net/shulianghan/article/deta

微信開發-- 發送模板消息

use keyword 選擇 調用 一次 png exc style col 我們需要將一些行為的進展消息推送給用戶。除了短信,發送微信模板消息也是不錯的選擇。模板消息免費、精準到達、而且可以引導用戶回到網站上來。但它有兩個前提條件。1個是必須開通了微信支付功能,你才能選擇

Unity遊戲開發淺談Unity遊戲開發中的單元測試

可靠 屬於 sin 自定義類型 允許 ogr 兩個 階段 ast 一、單元測試的定義與作用   單元測試定義:單元測試在傳統軟件開發中是非常重要的工具,它是指對軟件中的最小可測試單元進行檢查和驗證,一般情況下就是對代碼中的一個函數去進行驗證,檢查它的正確性。一個單元測試是

ci框架基礎之部署百度編輯器

asc 點擊 class containe 壓縮版 合並 ueditor builder 插件 在ci框架下加載編輯器,現在復習下內容。我的框架文件名稱為ci 1.下載百度編輯器ueditor,http://ueditor.baidu.com/ 一般情況下下載ubuil

學習python 測試開發

ror 獲得 inf img get detail gpo pex 如果 https://ke.qq.com/course/263945#tuin=107a3c8a https://testerhome.com/topics/11327 python版本:2.7.* 第一節

Unity遊戲開發AssetBundle雜記--AssetBundle的二三事

比較 streaming 指定 但是 chunk 加載 公司 prefab 方法 一、簡介   馬三在公司大部分時間做的都是遊戲業務邏輯和編輯器工具等相關工作,因此對Unity AssetBundle這塊的知識點並不是很熟悉,自己也是有打算想了解並熟悉一下AssetBun

編程開發PHP---面向對象

系統 mys bst 賦值 構造 權限 私有 完成 抽象 面向對象編程 類:在現實世界中,任何事物都有種類的概念:車   類是由特征和行為構成的。     特征:都是不動的,從出廠的時候就已經內置好了(屬性)     行為:一種動的狀態。(方法(函數))   行為依賴於這些

golang-GUI開發項目的編譯

腳本 中間 成了 語法 代碼 port recipe 時間 講解 在上一篇文章裏,我們講到了安裝therecipe/qt(https://www.cnblogs.com/apocelipes/p/9296754.html),現在我們來講講如何編譯使用了therecipe/q