一个简单实现的自定义控件之MD风格的圆环进度条
实现效果:
步骤:1:
allprojects { repositories { ... maven { url "https://jitpack.io" } } }
步骤2:添加依赖
dependencies { compile 'com.github.HotBitmapGG:RingProgressBar:V1.2.1' }
使用说明
1.在XML中
app:max="100" app:ringColor="@color/colorPrimary" app:ringProgressColor="@color/colorPrimaryDark" app:ringWidth="4dp" app:style="STROKE" app:textColor="@color/colorPrimary" app:textIsShow="true" app:textSize="16sp"
2.代码中
mRingProgressBar = (RingProgressBar) findViewById(R.id.progress_bar); //设置进度条的进度值 mRingProgressBar.setProgress(progress); mRingProgressBar.setOnProgressListener(new RingProgressBar.OnProgressListener() { @Override public void progressToComplete() { // 进度达到最大值时回调 默认max进度值为100 Toast.makeText(MainActivity.this, "完成", Toast.LENGTH_SHORT).show(); } });