/**
* 获取文案的长度
*
* @param aText aText
* @param textSize textSize
* @return 文案长度
*/
private int getTextWidth(String aText, float textSize) {
if (aText == null || aText.length() == 0) {
return 0;
}
Paint p = new Paint();
p.setTextSize(textSize);
float width = p.measureText(aText);
return (int) (Math.round(NUMBER + width));
}
Android 计算文案占用长度
最新推荐文章于 2023-03-17 15:37:10 发布