public class PaintTextHeightUtils {
public static int getTextHeight(Paint paint) { //前提是先設置文字大小
Paint.FontMetricsInt fm = paint.getFontMetricsInt();
int textHeight = ~fm.top - (~fm.top - ~fm.ascent) - (fm.bottom - fm.descent);
return textHeight;
}
// 文字寬度 paint.measureText(text);
}