-
Notifications
You must be signed in to change notification settings - Fork 51
Open
Description
Here's how to fix it.
private float findNewTextSize(int width, int height, CharSequence text) {
TextPaint textPaint = new TextPaint(getPaint());
float targetTextSize = getMaxTextSize(); // Start from the max size
int textHeight = getTextHeight(text, textPaint, width, targetTextSize);
while(textHeight > height && targetTextSize > mMinTextSize) {
targetTextSize = Math.max(targetTextSize - 1, mMinTextSize);
textHeight = getTextHeight(text, textPaint, width, targetTextSize);
}
return targetTextSize;
}Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels