new#适配联想pad

This commit is contained in:
wujifei
2021-05-14 14:51:51 +08:00
parent 41cb1dfd27
commit 4ef9314aac
23 changed files with 166 additions and 58 deletions

View File

@@ -28,7 +28,7 @@ public class ArcView extends View {
//圆弧颜色
private int mArcColor;
//圆弧的画笔的宽度
private float mStrokeWith = 10;
private float mStrokeWith = dp2px(10);
//文字描述的paint
private Paint mTextPaint;
@@ -77,7 +77,7 @@ public class ArcView extends View {
mTextPaint.setTypeface(Typeface.defaultFromStyle(Typeface.NORMAL));
//绘制中心文字描述
mTextPaint.setTextSize(28);
mTextPaint.setTextSize(dp2px(28));
mTextPaint.getTextBounds(mDes, 0, mDes.length(), mRect);
canvas.drawText(mDes, getWidth() / 2, getHeight() * 17 / 20 + mRect.height() / 2, mTextPaint);
}
@@ -116,7 +116,7 @@ public class ArcView extends View {
//设置文本的对齐方式
mTextPaint.setTextAlign(Paint.Align.CENTER);
//mTextPaint.setTextSize(getResources().getDimensionPixelSize(R.dimen.dp_12));
mTextPaint.setTextSize(80);
mTextPaint.setTextSize(dp2px(80));
}