Skip to content

Commit 001e2b2

Browse files
committed
Update
1 parent 41026ae commit 001e2b2

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

‎CustomView/Fix/DrawText.md‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,10 +77,13 @@ Align对应的方法自然是setTextAlign,如下:
7777
其核心代码如下:
7878

7979
``` java
80-
canvas.translate(mCenterX,0);
80+
// 平移画布
81+
canvas.translate(mCenterX,0); // mCenterX 是屏幕宽度的一半,在onSizeChanged中获取
8182

82-
mPaint.setColor(Color.rgb(0x06,0xaf,0xcd));
83+
// 设置字体颜色
84+
mPaint.setColor(Color.rgb(0x06,0xaf,0xcd));
8385

86+
// 在不同模式下绘制文字
8487
mPaint.setTextAlign(Paint.Align.LEFT);
8588
canvas.drawText("左对齐", 0, 200, mPaint);
8689

0 commit comments

Comments
 (0)