Android/Development Tips

Measuring of String in android

Nanamare 2018. 2. 12. 10:28
728x90

Paint p = new Paint();
Rect bounds = new Rect();
p.getTextBounds(labelString, 0, labelString.length(), bounds);

float height = p.measureText(labelString);
int width = bounds.width();

 

728x90