Step 1. Add the JitPack repository to your build file
Add it in your root build.gradle at the end of repositories:
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
Step 2. Add the dependency
dependencies {
implementation 'com.github.AlphaXu917:Widgets:1.0.0'
}
<com.alpha.views.StepView android:id="@+id/mStepView" android:layout_marginTop="10dp" android:layout_width="300dp" android:layout_height="300dp" android:layout_gravity="center" app:borderWidth="20dp" app:stepGroundColor="@color/teal_200" app:progressColor="@color/purple_200" app:maxStep="10000" app:currentStep="1000" app:stepTextSize="30sp" app:textTypeFace="bold" app:stepTextColor="@color/black"/>
app:borderWidth 圆环宽度
app:stepGroundColor 圆环底部颜色
app:progressColor 圆环进度颜色
app:maxStep 最大进度(步数)
app:currentStep 当前进度(步数)
app:stepTextSize 文字字体大小
app:stepTextColor 文字颜色
app:textTypeFace 字体样式(normal、bold、italic)
app:isFullCircle 是否完整的圆
app:startAngle 起始角度(90-180,小于90度显示整个圆)
设置最大进度(步数)
setStepMax(stepMax: Int)
设置当前进度(步数)
setCurrentStep(currentStep: Int)
设置当前进度(步数)添加动画
setCurrentStepWithAnimator(currentStep: Int, duration: Long = 1000)