【Android】開源項目UI控件分類匯總之ProgressBar


  Android開發的寶庫越來越多,我開發中有需要的組件,主要參考Trinea的大作Android開源項目分類匯總(包含了后面的絕大多數)、CSDN上直接拿來用!最火的Android開源項目還有CSDN上的直接拿來用!十大Material Design開源項目受益匪淺,但是,有的分類項目太多,不是每個項目都有預覽,不容易找到什么是最想要的,而且有一些項目不容易順利地導入,我把同類的Demo做到一個app里,供大家下載參考。不過順序沒有按Trinea的大作來,當下需要什么控件,就優先寫哪些,先從最近用的ProgressBar開始,progressbar的相關工程全部從Trinea的匯總中得來,並且就按Trinea的順序給出。

  因為我的Demo是多個sample的集合,那么每個項目的demo都涉及哪些文件,可能會覺得比較亂,如無特殊說明,只有和項目名同名的Activity還有對應的layout。因為所有的庫都是做同樣的事情,它們自定義屬性的時候可能出現沖突,這種情況我稍微修改了部分的屬性名,前面是各個項目的預覽圖,后面是對每個項目的說明,包括我是否做了修改。

  綜合所有ProgressBar效果的Demo App下載,對應的Android Studio工程下載。

1. SmoothProgressBar

SmoothProgressBar

2. ProgressWheel

Sample ImageSample Image 2Sample Image 3Sample Image 4

3. android-square-progressbar

three examples

4. HoloCircularProgressBar

   

5. ProgressButton

Pin Progress Button Android developer

6. GoogleProgressBar

FoldingCirclesProgressBar   GoogleMusicDicesDrawable   NexusRotationCross.gif

7. THProgressButton

 alt text

8. NumberProgressBar

NumberProgressBar

9. CircularProgressDrawable

Overshoot Example     Colorfill Example

10. circular-progress-button     11. WaveView

     

 

 1. SmoothProgressBar

項目地址:https://github.com/castorflex/SmoothProgressBar

項目描述:這個水平進度條的確是很漂亮,但是在sample里還定義了大量的樣式,眼光繚亂,我覺得作者demo里的這幾個樣式已經很好看,大可不必再去自定義。這個項目有兩個library,一個是水平進度條的,還有一個是圓形進度條的,這兩個本身在maven上都有,圓形進度條我是引的maven的,但水平進度條的庫我是在本地引入,然后把demo里的樣式移到了library里面,這樣用的時候只把layout里的組件粘貼一下就可以了。如果按照sample里的自己定義樣式,那么可以直接引用官方的庫:

compile 'com.github.castorflex.smoothprogressbar:library:1.0.0'
compile 'com.github.castorflex.smoothprogressbar:library-circular:1.0.2'

本項目的相關文件為:

org.zhangfc.android.pb.smoothprogressbar.SpbMainActivity
@layout/spb_activity_main
org.zhangfc.android.pb.smoothprogressbar.SpbMakeCustomActivity
@layout/spb_activity_custom

 

2. ProgressWheel

項目地址:https://github.com/Todd-Davies/ProgressWheel

項目說明:這個比較簡單,都是圓形的ProgressBar,將庫作為project library導入。即可。

 

3. android-square-progressbar

項目地址:https://github.com/mrwonderman/android-square-progressbar

接口說明:https://github.com/mrwonderman/android-square-progressbar/wiki/Usage

項目說明:這個項目是在圖片周圍顯示進度。它的官方Demo很亂,文檔也很散,我基本沒有看官方的Demo,直接按照文檔上的幾個examples寫的Demo。關於庫的導入,原作者並沒有把這個項目上傳到maven,所以最新版的只能本地引入。有另外一個人把這個項目放到了maven倉庫里,不過版本不是最新的。寫這篇文章的時候,maven倉庫里的版本號是1.3.0,而最新的1.4.0對文字自定義樣式、自定義Bitmap的支持1.3.0都是沒有的,注意自定義Bitmap的時候會拋一個NullPointerException,打開library的SquareProgressBar,在最后一個方法setImageBitmap里面加上對imageView的賦值就好了:

public void setImageBitmap(Bitmap bitmap){
    imageView = (ImageView) findViewById(R.id.imageView1);
    imageView.setImageBitmap(bitmap);
}

所以還是建議使用本地library。但如果還是想使用maven倉庫的版本,首先指定maven位置:

repositories {
    maven {
        url 'https://raw.github.com/elodieferrais/wonder-libraries/master'
        name 'github-wonder-libraries'
    }
}

然后在依賴中引入:

compile 'net.yscs.android:square_progressbar:1.3.0'

本項目相關的資源文件為

drawable-hdpi/sqpb_city.jpg

 

4. HoloCircularProgressBar

項目地址:https://github.com/passsy/android-HoloCircularProgressBar

項目說明:Android4.1 時鍾App樣式。這個項目的library只能在本地導入,Demo中原作者還在menu中加入了兩種Theme的切換,為了Demo的簡單性,我刪了相關代碼,效果可以直接看官方提供的Demo圖片。當然,刪除了設置主題的代碼,Demo關於動畫的控制也還不少。因為屬性和其它項目沖突,我把progress屬性換成了circular_progress。

 

5. ProgressButton

項目地址:https://github.com/f2prateek/progressbutton

文檔地址:http://f2prateek.com/progressbutton/

項目說明:用圖釘顯示進度,本來這個項目直接引用maven當中的庫沒有問題,但是因為我把所有的progressbar整合在一起,有一些自定義屬性發生了沖突,所以我只能在本地導入,修改一下屬性名。真正在使用這個項目時,在gradle文件中指定庫的位置:

compile 'com.f2prateek:progressbutton:1.0.3@aar'

使用自定義屬性時,我把circleColor改為pbtn_circleColor,progress改為pbtn_progress,max換為pbtn_max。

 

6. GoogleProgressBar

項目地址:https://github.com/jpardogo/GoogleProgressBar

項目說明:Google風格的ProgressBar,直接引用maven庫,Demo里提供了選擇顏色的UI,簡化期間,只並列放了三種風格的ProgressBar,怎么設定顏色在代碼里非常清晰,在getProgressDrawableColors方法中修改即可。

 

7. THProgressButton

項目地址:https://github.com/torryharris/TH-ProgressButton

項目說明:帶有圓形進度顯示的按鈕,這個項目本身沒有區分library和sample,作者只是建議直接把兩個類放到自己的項目里就可以用了。我也把這個library提取了出來,作為project library引入。

 

8. NumberProgressBar

項目地址:https://github.com/daimajia/NumberProgressBar

項目說明:直接maven引入庫,帶有數字指示的進度條,可以自定義數字前后的粗細。

 

9. CircularProgressDrawable

項目地址:https://github.com/Sefford/CircularProgressDrawable

項目說明:比較好看的一個庫,直接引入maven庫,圓形顯示進度。

 

10. circular-progress-button

項目地址:https://github.com/dmytrodanylyk/circular-progress-button

項目說明:圓形按鈕,需要顯示為進度時轉化為圓形進度條。直接引入maven庫。

資源文件:除了Activity和layout,還有三個自定義的動畫文件:

drawable/complete_state_selector.xml
drawable/error_state_selector.xml
drawable/idle_state_selector.xml

 

11 WaveView

項目地址:https://github.com/john990/WaveView

項目說明:波紋效果的View,可以作為沒有進度值的進度條,因為和其他項目的屬性沖突,將progress屬性改為wave_progress,library從module引入。


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM