Skip to content

Commit 4268f3e

Browse files
committed
Update
1 parent 809e0cf commit 4268f3e

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

‎CustomView/Advance/[7]DrawText.md‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,15 @@ leading | + | 行间距,当前行bottom与下一行top之间的距离的推荐
190190

191191
> 不会, **FontMetrics中的数值受字体大小(FontSize) 和 字体风格(Typeface) 影响**, 而不会因为具体绘制的内容不同而改变,给Paint设置完字体大小和字体风格后就能获取到正确的FontMetrics。
192192
193+
#### 文字居中
194+
195+
根据前面的知识可知,想让文字水平居中很容易,只需要设置 TextAlign 为 CENTER,然后将x坐标直接指定为中心轴即可。
196+
197+
而让文字垂直居中则有些麻烦了,因为文字的基线Y的位置很特殊,下面我们探讨一下如何让文字真正实现居中显示。
198+
199+
200+
201+
193202

194203

195204

0 commit comments

Comments
 (0)