个人信息完善
This commit is contained in:
@@ -2,6 +2,7 @@ package com.dahe.mylibrary.weight;
|
||||
|
||||
import android.animation.ValueAnimator;
|
||||
import android.content.Context;
|
||||
import android.content.res.TypedArray;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Paint;
|
||||
import android.graphics.Point;
|
||||
@@ -65,7 +66,7 @@ public class CircleBarView2 extends View {
|
||||
|
||||
public CircleBarView2(Context context, AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
initAttrs(context);
|
||||
initAttrs(context,attrs);
|
||||
}
|
||||
|
||||
public int getMax() {
|
||||
@@ -134,13 +135,15 @@ public class CircleBarView2 extends View {
|
||||
invalidate();
|
||||
}
|
||||
|
||||
private void initAttrs(Context context) {
|
||||
private void initAttrs(Context context, AttributeSet attrs) {
|
||||
|
||||
TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.CircleBarView);
|
||||
// 文字间距
|
||||
textMargin = dp2px(context, 5);
|
||||
// 圆弧宽度
|
||||
roundWidth = dp2px(context, 5);
|
||||
roundWidth = dp2px(context, 8);
|
||||
// 半径
|
||||
radius = dp2px(context, 72);
|
||||
radius = dp2px(context, 92);
|
||||
height = radius;
|
||||
// 小间距
|
||||
smallMargin = roundWidth / 2;
|
||||
@@ -155,15 +158,15 @@ public class CircleBarView2 extends View {
|
||||
innerPaint.setColor(context.getColor(R.color.color_f15));
|
||||
innerPaint.setStyle(Paint.Style.STROKE);
|
||||
innerPaint.setStrokeCap(Paint.Cap.ROUND);
|
||||
innerPaint.setStrokeWidth(roundWidth);
|
||||
innerPaint.setStrokeWidth(roundWidth+10);
|
||||
|
||||
mTextPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
|
||||
mTextPaint.setColor(context.getColor(R.color.color_ff3));
|
||||
mTextPaint.setTextSize(sp2px(getContext(), 24));
|
||||
mTextPaint.setColor(context.getColor(R.color.color_9));
|
||||
mTextPaint.setTextSize(sp2px(getContext(), 16));
|
||||
|
||||
mValueTextPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
|
||||
mValueTextPaint.setColor(valueColor);
|
||||
mValueTextPaint.setTextSize(sp2px(getContext(), 24));
|
||||
mValueTextPaint.setTextSize(sp2px(getContext(), 34));
|
||||
|
||||
mUnitTextPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
|
||||
mUnitTextPaint.setColor(context.getColor(R.color.color_ff3));
|
||||
|
||||
Reference in New Issue
Block a user