常规的、圆角的进度条,分为带图标的和不带图标的。另外,感觉开发者也是很用心的。
效果图:
如何使用不带图标的
不带图标的使用创建:
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" />
属性说明
提供的方法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" />
属性说明
提供的方法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)