对于Android Studio的用户,可以选择添加:
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
compile 'com.github.ppg408331701:SemicircleProgress:v0.5.0'
配置参数 | 参数含义 |
---|---|
semicircleSize | 半弧形的半径大小,默认100dp |
semicirclebackgroundLineColor | 半弧形的背景线颜色,默认灰色 |
semicirclefrontLineColor | 半弧形的前景线颜色,默认橘黄色 |
semicirclelineSize | 半弧形的线宽度,默认3dp |
semicirclesubtitleColor | 副标题字体颜色 |
semicirclesubtitleSize | 副标题字体大小 |
semicirclesubtitleText | 副标题文本 |
semicircletitleColor | 标题字体颜色 |
semicircletitleSize | 标题字体大小 |
semicircletitleText | 标题文本 |
配置参数 | 参数含义 |
---|---|
circularLeftText | 左边文本 |
circularLeftTextColor | 左边字体颜色 |
circularLeftTextSize | 左边字体大小 |
circularRightText | 右边文本 |
circularRightTextColor | 右边字体颜色 |
circularRightTextSize | 右边字体大小 |
circularSize | 圆的大小 |
circularbackgroundLineColor | 圆形的背景线颜色 |
circularfrontLineColor | 圆形的前景线颜色 |
circularcentreBitmap | 中间的颜色 |
circularlineSize | 线的宽度 |
circularshowBitmap | 是否显示中间的图片 |
<simple.ppg.com.ppgsemicircle.Views.SemicircleProgressView
android:id="@+id/semicircleProgressView"
android:layout_width="match_parent"
android:layout_height="150dp"
app:semicircleSize="140dp"
app:semicirclebackgroundLineColor="@color/colorPrimary"
app:semicirclefrontLineColor="@color/colorAccent"
app:semicirclelineSize="3dp"
app:semicirclesubtitleColor="@color/colorPrimary"
app:semicirclesubtitleSize="15sp"
app:semicirclesubtitleText="integral"
app:semicircletitleColor="@color/colorAccent"
app:semicircletitleSize="20sp"
app:semicircletitleText="积分" />
semicircleProgressView = (SemicircleProgressView) findViewById(R.id.semicircleProgressView);
semicircleProgressView.setSesameValues(10, 50);
<simple.ppg.com.ppgsemicircle.Views.CircularProgressar
android:id="@+id/sesame_view"
android:layout_width="270dp"
android:layout_height="150dp"
android:layout_gravity="center"
android:layout_marginTop="10dp"
app:circularLeftText="50%"
app:circularLeftTextColor="@color/colorPrimary"
app:circularLeftTextSize="14sp"
app:circularRightText="50/100"
app:circularRightTextColor="@color/colorPrimary"
app:circularRightTextSize="14sp"
app:circularSize="120dp"
app:circularbackgroundLineColor="@color/colorPrimary"
app:circularcentreBitmap="@mipmap/icon_1"
app:circularfrontLineColor="@color/colorAccent"
app:circularlineSize="3dp"
app:circularshowBitmap="true" />
sesame_view = (CircularProgressar) findViewById(R.id.sesame_view);
sesame_view.setSesameValues(50, 100);//设定进度
sesame_view.setDuration(5000);//设定波浪从最小到最大的时间
sesame_view.setStyle(Paint.Style.FILL);//设置画笔风格
sesame_view.setColor(ContextCompat.getColor(this, R.color.colorAccent));//设置波浪颜色
sesame_view.setInterpolator(new LinearOutSlowInInterpolator());//设置插值器
sesame_view.start();//开始
// sesame_view.stop();//缓慢停止
// sesame_view.stopImmediately();//立刻停止