Android 圆角进度条RoundCornerProgressBar

转自:http://www.jcodecraeer.com/a/opensource/2015/0115/2313.html

介绍:

圆角矩形进度条,包含带图标和不带图标两种形式

运行效果:

使用说明:

布局文件中添加roundcornerprogressbar控件

<com.akexorcist.roundcornerprogressbar.RoundCornerProgressBar
        android:layout_width="dimension"
        android:layout_height="dimension"
        app:backgroundPadding="dimension"
        app:backgroundRadius="dimension"
        app:backgroundColor="color"
        app:progressColor="color"
        app:progress="integer"
        app:max="integer" />
属性说明:

usage_002.jpg

添加iconroundcornerprogressbar

<com.akexorcist.roundcornerprogressbar.IconRoundCornerProgressBar
        android:layout_width="dimension"
        android:layout_height="dimension"
        app:iconPadding="dimension"
        app:iconSize="dimension"
        app:iconSrc="drawable"
        app:backgroundPadding="dimension"
        app:backgroundRadius="dimension"
        app:backgroundColor="color"
        app:headerColor="color"
        app:progressColor="color"
        app:progress="integer"
        app:max="integer" />
属性说明:

usage_001.jpg


RoundCornerProgressBar的公共方法:

void setProgressColor(int color)
int getProgressColor()
void setBackgroundColor(int color)
int getBackgroundColor()
 
void setMax(float max)
int getMax()
void setProgress(float progress)
int getProgress()
IconRoundCornerProgressBar的公共方法:

void setProgressColor(int color)
int getProgressColor()
void setBackgroundColor(int color)
int getBackgroundColor()
void setHeaderColor(int color)
int getHeaderColor()
 
void setMax(float max)
int getMax()
void setProgress(float progress)
int getProgress()
 
void setIconImageResource(int resource)
void setIconImageBitmap(Bitmap bitmap)
void setIconImageDrawable(Drawable drawable)
例子:

xml

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_height="match_parent" 
    android:layout_width="match_parent" >
 
    <com.akexorcist.roundcornerprogressbar.RoundCornerProgressBar
        android:id="@+id/progress_1"
        android:layout_height="320dp" 
        android:layout_width="40dp" 
        app:backgroundPadding="5dp" />
 
    <com.akexorcist.roundcornerprogressbar.IconRoundCornerProgressBar
        android:id="@+id/progress_2"
        android:layout_height="320dp" 
        android:layout_width="wrap_content"
        app:backgroundPadding="10dp"
        app:iconSize="50dp" 
        app:iconPadding="5dp" />
 
</RelativeLayout>
java代码

RoundCornerProgressBar progress1 = (RoundCornerProgressBar) findViewById(R.id.progress_1);
progress1.setProgressColor(Color.parseColor("#ed3b27"));
progress1.setBackgroundColor(Color.parseColor("#808080"));
progress1.setMax(70);
progress1.setProgress(15);
 
int progressColor1 = progress1.getProgressColor();
int backgroundColor1 = progress1.getBackgroundColor();
int max1 = progress1.etMax();
int progress1 = progress1.getProgress();
 
RoundCornerProgressBar progress2 = (RoundCornerProgressBar) findViewById(R.id.progress_1);
progress2.setProgressColor(Color.parseColor("#56d2c2"));
progress2.setBackgroundColor(Color.parseColor("#757575"));
progress2.setHeaderColor(Color.parseColor("#38c0ae"));
progress2.setMax(550);
progress2.setProgress(147);
progress2.setIconImageResource(anyResource);
progress2.setIconImageBitmap(anyBitmap);
progress2.setIconImageDrawable(anyDrawable);
 
int progressColor2 = progress2.getProgressColor();
int backgroundColor2 = progress2.getBackgroundColor();
int headerColor2 = progress2.getHeaderColor();
int max2 = progress2.getMax();
int progress2 = progress2.getProgress();

源码下载


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值