Paint mTextPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
mTextPaint.setColor(Color.WHITE);
// Define the string.
String displayText = “Hello World!”;
// Measure the width of the text string.
float textWidth = mTextPaint.measureText(displayText);
取得文字的宽度
本文介绍了一种使用Paint对象测量文本字符串宽度的方法。通过设置Paint对象的抗锯齿属性并定义要显示的文本,可以准确地测量出文本的宽度。
1417

被折叠的 条评论
为什么被折叠?



