Scale text in a view to fit?

You can use the TextUtils.EllipsizeCallback. When the text gets ellipsized this callback is done by the textview. Here you can set text size smaller than the current.

EDIT : Otherwise you can use TextUtils.ellipsize this way

while (mText != TextUtils.ellipsize(mText, textPaint, other params)) { 
    textpaint.setTextSize(textpaint.getTextSize() - 1);
}

Leave a Comment