【问题标题】:How to get a pixel width of a string in android?如何在android中获取字符串的像素宽度?
【发布时间】:2013-11-20 06:34:29
【问题描述】:

屏幕上显示字符串“123456”。我想得到那个字符串的宽度。

【问题讨论】:

标签: android


【解决方案1】:

我没试过,但可能是这样的:

mPaint = new Paint();
mPaint.setTextSize(64);
//...
float width = mPaint.measureText(text, 0, text.length());

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2011-04-07
    • 1970-01-01
    • 1970-01-01
    • 2013-06-17
    • 2013-05-12
    • 1970-01-01
    相关资源
    最近更新 更多