首页 > 代码库 > ProgressWheel:Android开源圆环进度条

ProgressWheel:Android开源圆环进度条

这是一个自定义Android组件,用于代替标准进度条组件。实现各种进度条样式,包括圆环,扫描等。

XML:
在你的attr.xml(res/value)中加入以下

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
<declare-styleable name="ProgressWheel">  
    <attr name="text"format="string"/>  
    <attr name="textColor"format="color"/>  
    <attr name="textSize"format="dimension"/>  
    <attr name="barColor"format="color"/>  
    <attr name="rimColor"format="color"/>  
    <attr name="rimWidth"format="dimension"/>  
    <attr name="spinSpeed"format="integer"/>    
    <attr name="circleColor"format="color"/>    
    <attr name="radius"format="dimension"/>  
    <attr name="barWidth"format="dimension"/>  
    <attr name="barLength"format="dimension"/>
    <attr name="delayMillis"format="dimension"/>
    <attr name="contourColor"format="color"/>
    <attr name="contourSize"format="float"/>
</declare-styleable>

在你的root view 中加入

1
xmlns:ProgressWheel="http://schemas.android.com/apk/res/com.visualdenim.schooltraq"
1
在你的xml合适的地方加入 组件
1
2
3
4
5
6
7
8
9
10
11
12
13
<com.todddavies.components.progressbar.ProgressWheel  
    android:id="@+id/pw_spinner"    
    android:layout_width="200dp"   
    android:layout_height="200dp"  
    android:layout_centerInParent="true"  
    ProgressWheel:text="Authenticating..."   
    ProgressWheel:textColor="#222"  
    ProgressWheel:textSize="14sp"  
    ProgressWheel:rimColor="#330097D6"  
    ProgressWheel:barLength="60dp"   
    ProgressWheel:barColor="#0097D6"  
    ProgressWheel:barWidth="5dp"  
    ProgressWheel:rimWidth="2dp"/>

Java:

你需要从layout中获得进度条,或者初始化

1
2
ProgressWheel pw = newProgressWheel(myContext, myAttributes);
ProgressWheel pw = (ProgressWheel) findViewById(R.id.pw_spinner);

使用.spin() 开始进度条滚动, .stopSpinning 停止进度条滚动

增加进度有点棘手,  你可以调用.incrementProgress(), 但是这样就超过了360度, 因为一个圆有360度, 你超过360度就会自动重置, 一个百分百自动分配

http://c.tieba.baidu.com/p/3425898733
http://c.tieba.baidu.com/p/3425900530
http://c.tieba.baidu.com/p/3425907267
http://c.tieba.baidu.com/p/3425908675
http://c.tieba.baidu.com/p/3425909347
http://c.tieba.baidu.com/p/3425911528
http://c.tieba.baidu.com/p/3425912792
http://c.tieba.baidu.com/p/3425912875
http://c.tieba.baidu.com/p/3425914867
http://c.tieba.baidu.com/p/3425926733
http://c.tieba.baidu.com/p/3441567009
http://c.tieba.baidu.com/p/3441568050
http://c.tieba.baidu.com/p/3441570708
http://c.tieba.baidu.com/p/3441571432
http://c.tieba.baidu.com/p/3441572824
http://c.tieba.baidu.com/p/3451501811
http://c.tieba.baidu.com/p/3451508181
http://c.tieba.baidu.com/p/3451512569
http://c.tieba.baidu.com/p/3451517520
http://c.tieba.baidu.com/p/3451528407
http://c.tieba.baidu.com/p/3451517520
http://c.tieba.baidu.com/p/3451528407
http://c.tieba.baidu.com/p/3451546650
http://c.tieba.baidu.com/p/3451552596
http://c.tieba.baidu.com/p/3451558511
http://c.tieba.baidu.com/p/3451564361
http://c.tieba.baidu.com/p/3451570242
http://c.tieba.baidu.com/p/3451575955
http://c.tieba.baidu.com/p/3451581805
http://c.tieba.baidu.com/p/3451587508
http://c.tieba.baidu.com/p/3451593096
http://c.tieba.baidu.com/p/3451598614
http://c.tieba.baidu.com/p/3451604155
http://c.tieba.baidu.com/p/3451609517
http://c.tieba.baidu.com/p/3451614868
http://c.tieba.baidu.com/p/3451620307
http://c.tieba.baidu.com/p/3451625535
http://c.tieba.baidu.com/p/3451630601
http://c.tieba.baidu.com/p/3451635676
http://c.tieba.baidu.com/p/3451640781
http://c.tieba.baidu.com/p/3451660347
http://c.tieba.baidu.com/p/3451635676
http://c.tieba.baidu.com/p/3451640781
http://c.tieba.baidu.com/p/3451645843
http://c.tieba.baidu.com/p/3451650855
http://c.tieba.baidu.com/p/3451660347
http://c.tieba.baidu.com/p/3451665622
http://c.tieba.baidu.com/p/3451671457
http://c.tieba.baidu.com/p/3451676723
http://c.tieba.baidu.com/p/3451682028
http://c.tieba.baidu.com/p/3451687339
http://c.tieba.baidu.com/p/3451692782
http://c.tieba.baidu.com/p/3451698271
http://c.tieba.baidu.com/p/3451703740
http://c.tieba.baidu.com/p/3451714240
http://c.tieba.baidu.com/p/3451719491
http://c.tieba.baidu.com/p/3451724944
http://c.tieba.baidu.com/p/3451730537
http://c.tieba.baidu.com/p/3451735926
http://c.tieba.baidu.com/p/3451741336
http://c.tieba.baidu.com/p/3451752396
http://c.tieba.baidu.com/p/3451757960
http://c.tieba.baidu.com/p/3451763540
http://c.tieba.baidu.com/p/3451769087
http://c.tieba.baidu.com/p/3451780071
http://c.tieba.baidu.com/p/3451785507
http://c.tieba.baidu.com/p/3451790926
http://c.tieba.baidu.com/p/3451796475
http://c.tieba.baidu.com/p/3451801995
http://c.tieba.baidu.com/p/3451807533
http://c.tieba.baidu.com/p/3451813061
http://c.tieba.baidu.com/p/3451818556
http://c.tieba.baidu.com/p/3451824066
http://c.tieba.baidu.com/p/3451824066
http://c.tieba.baidu.com/p/3451835426
http://c.tieba.baidu.com/p/3451841091
http://c.tieba.baidu.com/p/3451846715
http://c.tieba.baidu.com/p/3451852555
http://c.tieba.baidu.com/p/3451858334
http://c.tieba.baidu.com/p/3452256667
http://c.tieba.baidu.com/p/3452191167
http://c.tieba.baidu.com/p/3452196681
http://c.tieba.baidu.com/p/3452200615
http://c.tieba.baidu.com/p/3452206320
http://c.tieba.baidu.com/p/3452256667
http://c.tieba.baidu.com/p/3452495966
http://c.tieba.baidu.com/p/3452500595
http://c.tieba.baidu.com/p/3452511669
http://c.tieba.baidu.com/p/3452518385
http://c.tieba.baidu.com/p/3452550987
http://c.tieba.baidu.com/p/3452564833
http://c.tieba.baidu.com/p/3452577465
http://c.tieba.baidu.com/p/3452619864
http://c.tieba.baidu.com/p/3452630773
http://c.tieba.baidu.com/p/3452619864
http://c.tieba.baidu.com/p/3453239963
http://c.tieba.baidu.com/p/3453242249
http://c.tieba.baidu.com/p/3453244530
http://c.tieba.baidu.com/p/3453258210
http://c.tieba.baidu.com/p/3453260354
http://c.tieba.baidu.com/p/3453263167
http://c.tieba.baidu.com/p/3453265983
http://c.tieba.baidu.com/p/3453268894
http://c.tieba.baidu.com/p/3453271934
http://c.tieba.baidu.com/p/3453275054
http://c.tieba.baidu.com/p/3453391863
http://c.tieba.baidu.com/p/3453401234
http://c.tieba.baidu.com/p/3453406659
http://c.tieba.baidu.com/p/3453412300
http://c.tieba.baidu.com/p/3453417928
http://c.tieba.baidu.com/p/3453423562
http://c.tieba.baidu.com/p/3453429315
http://c.tieba.baidu.com/p/3453435244
http://c.tieba.baidu.com/p/3453441305
http://c.tieba.baidu.com/p/3453447385
http://c.tieba.baidu.com/p/3453453547
http://c.tieba.baidu.com/p/3453459320
http://c.tieba.baidu.com/p/3453465288
http://c.tieba.baidu.com/p/3453471161
http://c.tieba.baidu.com/p/3453477161
http://c.tieba.baidu.com/p/3453483087
http://c.tieba.baidu.com/p/3453488996
http://c.tieba.baidu.com/p/3453495011
http://c.tieba.baidu.com/p/3453500792
http://c.tieba.baidu.com/p/3453506739
http://c.tieba.baidu.com/p/3453512953
http://c.tieba.baidu.com/p/3453519007
http://c.tieba.baidu.com/p/3454342449
http://c.tieba.baidu.com/p/3454346699
http://c.tieba.baidu.com/p/3454353334
http://c.tieba.baidu.com/p/3454359200
http://c.tieba.baidu.com/p/3454365360
http://c.tieba.baidu.com/p/3454371222
http://c.tieba.baidu.com/p/3454377261
http://c.tieba.baidu.com/p/3454383443
http://c.tieba.baidu.com/p/3454389543
http://c.tieba.baidu.com/p/3454395700
http://c.tieba.baidu.com/p/3454401877
http://c.tieba.baidu.com/p/3454408176
http://c.tieba.baidu.com/p/3454414465
http://c.tieba.baidu.com/p/3454420609
http://c.tieba.baidu.com/p/3454427170
http://c.tieba.baidu.com/p/3454445983
http://c.tieba.baidu.com/p/3454452546
http://c.tieba.baidu.com/p/3454459087
http://c.tieba.baidu.com/p/3454465738
http://c.tieba.baidu.com/p/3454472255
http://c.tieba.baidu.com/p/3454478736
http://c.tieba.baidu.com/p/3454485160
http://c.tieba.baidu.com/p/3454491608
http://c.tieba.baidu.com/p/3454498094
http://c.tieba.baidu.com/p/3454504776
http://c.tieba.baidu.com/p/3454511404
http://c.tieba.baidu.com/p/3454517946
http://c.tieba.baidu.com/p/3454524646
http://c.tieba.baidu.com/p/3454531331
http://c.tieba.baidu.com/p/3454537973
http://c.tieba.baidu.com/p/3454544653
http://c.tieba.baidu.com/p/3454551180
http://c.tieba.baidu.com/p/3454557749
http://c.tieba.baidu.com/p/3454564332
http://c.tieba.baidu.com/p/3454571118
http://c.tieba.baidu.com/p/3454670701
http://c.tieba.baidu.com/p/3454677894
http://c.tieba.baidu.com/p/3454685116
http://c.tieba.baidu.com/p/3454692366
http://c.tieba.baidu.com/p/3454699467
http://c.tieba.baidu.com/p/3454706718
http://c.tieba.baidu.com/p/3454714120
http://c.tieba.baidu.com/p/3454721866
http://c.tieba.baidu.com/p/3454729537
http://c.tieba.baidu.com/p/3454736804
http://c.tieba.baidu.com/p/3454743987
http://c.tieba.baidu.com/p/3454751197
http://c.tieba.baidu.com/p/3454758449
http://c.tieba.baidu.com/p/3454765819
http://c.tieba.baidu.com/p/3454772944
http://c.tieba.baidu.com/p/3454780462
http://c.tieba.baidu.com/p/3454787581
http://c.tieba.baidu.com/p/3454794665
http://c.tieba.baidu.com/p/3454801730
http://c.tieba.baidu.com/p/3454808639
http://c.tieba.baidu.com/p/3454815784
http://c.tieba.baidu.com/p/3454822720
http://c.tieba.baidu.com/p/3454829562
http://c.tieba.baidu.com/p/3454836204
http://c.tieba.baidu.com/p/3454842696
http://c.tieba.baidu.com/p/3454848962
http://c.tieba.baidu.com/p/3454855318
http://c.tieba.baidu.com/p/3454861446
http://c.tieba.baidu.com/p/3454867492
http://c.tieba.baidu.com/p/3454873305
http://c.tieba.baidu.com/p/3454879044
http://c.tieba.baidu.com/p/3454884899
http://c.tieba.baidu.com/p/3454890533
http://c.tieba.baidu.com/p/3454899742
http://c.tieba.baidu.com/p/3454906212
http://c.tieba.baidu.com/p/3455605389
http://c.tieba.baidu.com/p/3455610224
http://c.tieba.baidu.com/p/3455616325
http://c.tieba.baidu.com/p/3455622044
http://c.tieba.baidu.com/p/3455634028
http://c.tieba.baidu.com/p/3455656896
http://c.tieba.baidu.com/p/3455668823
http://c.tieba.baidu.com/p/3455674114
http://c.tieba.baidu.com/p/3455677438

ProgressWheel:Android开源圆环进度条