刻度样式进度条的载入控件, 除了刻度进度条外,其他任何部分都可自定义。项目地址:https://github.com/glomadrian/dashed-circular-progress 效果图:如何使用:<com.github.glomadrian.dashedcircularprogress.DashedCircularProgress
android:layout_width="300dp"
android:layout_height="300dp">
//这里你可以添加任意View,他将显示在控件的中心位置
</com.github.glomadrian.dashedcircularprogress.DashedCircularProgress>比如:<com.github.glomadrian.dashedcircularprogress.DashedCircularProgress
android:id="@ id/progress"
android:layout_centerInParent="true"
android:layout_width="300dp"
android:layout_height="300dp"
custom:min="0"
custom:max="100"
custom:duration="3500"
custom:progress_icon="@drawable/android">
<TextView android:id="@ id/text"
android:textSize="25sp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=""/>
</com.github.glomadrian.dashedcircularprogress.DashedCircularProgress>添加了一个用于显示进度的Textview。 你也可以添加ImageView等任何View。java代码:progress = (DashedCircularProgress)this.findViewById(R.id.progress);
text = (TextView)this.findViewById(R.id.text);
progress.setOnValueChangeListener(
new DashedCircularProgress.OnValueChangeListener() {//监听进度值的变化,
@Override
public void onValueChange(float value) {
text.setText((int) value "%");显示进度值
}
});
progress.setValue(50);//设置当前的进度值为50。注意progress.setValue()设置的并不是进度的百分比。而要知道进度完成的百分比,你还需要设置progress.setMax(),progress.setMin() 即进度的最大值、最小值。属性说明:external_color 外圈圆环的颜色base_color 内圈(显示进度的)圆环颜色progress_color 内圈已完成部分的圆环颜色max 进度最大值min 进度最小值progress_icon 设置顶端的图标duration 进度改变时,需要多长时间的动画达到这个值
评论0
最新资源