android进度条的图标,Android-RoundCornerProgressBar

本文介绍了如何在Android中创建圆角进度条,包括带图标和不带图标的实现方式,提供了详细的相关属性说明和使用示例。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

常规的、圆角的进度条,分为带图标的和不带图标的。另外,感觉开发者也是很用心的。

效果图:

120194481e415d64e3dccfdab1d74f9d.png

如何使用不带图标的

不带图标的使用创建:

android:id="@+id/roundCornerProgressBar"

android:layout_width="250dp"

android:layout_height="80dp"

android:layout_marginBottom="10dp"

android:layout_marginTop="10dp"

app:rcBackgroundColor="@color/custom_progress_background"

app:rcBackgroundPadding="10dp"

app:rcBackgroundRadius="30dp"

app:rcMax="100"

app:rcProgress="10"

app:rcProgressColor="@color/custom_progress_purple_progress" />

属性说明

08a3785d817b1f8fd816dbaedb0a2541.png

提供的方法void setProgressColor(int color)

int getProgressColor()

void setBackgroundColor(int color)

int getBackgroundColor()

void setMax(float max)

int getMax()

void setProgress(float progress)

int getProgress()

例如:RoundCornerProgressBar progress1 = (RoundCornerProgressBar) findViewById(R.id.progress_1);

progress1.setProgressColor(Color.parseColor("#ed3b27"));

progress1.setBackgroundColor(Color.parseColor("#808080"));

progress1.setMax(70);

progress1.setProgress(15);

2. 带图标的

使用创建:

android:id="@+id/iconRoundCornerProgressBar"

android:layout_width="250dp"

android:layout_height="wrap_content"

android:layout_marginBottom="10dp"

android:layout_marginTop="10dp"

app:rcBackgroundColor="@color/custom_progress_background"

app:rcBackgroundPadding="2dp"

app:rcBackgroundRadius="5dp"

app:rcHeaderColor="#00FF33"

app:rcIconPadding="5dp"

app:rcIconSize="40dp"

app:rcIconSrc="@drawable/ic_android"

app:rcMax="150"

app:rcProgress="90"

app:rcProgressColor="@color/custom_progress_red_progress" />

属性说明

8ce531c878c8b29ff8901c7c5c27926e.png

提供的方法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)

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值