CircleProgressBar一个仿照苹果应用市场App Store的圆形进度条下载按钮。
compile 'com.xiaozhiguang.library:CircleProgressBar:1.0.0'
1.在你的布局中引用自定义view
<com.app.views.CircleProgressBar
android:id="@+id/cpb_download"
android:layout_width="30dp"
android:layout_height="30dp"
app:cpb_default_progress_color="@color/gray"
app:cpb_download_progress_color="@color/colorAccent" />
cpb_default_progress_color:设置进度条默认的颜色,对应图中的灰色
cpb_download_progress_color:设置进度条进度的颜色,对应图中的红色
2.在你的Activity中初始化CircleProgressBar
private CircleProgressBar cpbDownload;
cpbDownloadPause = findViewById(R.id.cpb_download);
3.给CircleProgressBar设置样式等属性
cpbDownload.setStatue(CircleProgressBar.DOWNLOAD_DEF);
- DOWNLOAD_DEF 默认状态
- DOWNLOAD_PAUSE 暂停状态
- DOWNLOAD_STATUE 进行状态
- DOWNLOAD_FINISH 完成状态
4.给CircleProgressBar设置进度
cpbDownloadS.setProgress(60);