Like what method sizeWithFont:constrainedToSize:lineBreakMode: does in iOS. Thanks!
I'm sorry I didn't describe my question clearly. I can get the width and height of a given string with the method Paint.getTextBounds(String text, int start, int end, Rect bounds), but in this way, the given string is drawn in a single line. Now I wanna fix the width of the given string, and calculate the heigth of it.
For example, the given string is "abcdefghijklmn", the textsize is 20sp and the width of the drawn text is fixed to 100dp, then the string should be drawn like below, and I want to calculate the height of it. Please ignore the redundant line break below.
abcde
fghij
klmn