android - Auto Scale TextView Text to Fit within Bounds -
i'm looking optimal way resize wrapping text in textview
fit within getheight , getwidth bounds. i'm not looking way wrap text- want make sure both wraps , small enough fit entirely on screen.
i've seen few cases on stackoverflow auto resizing needed, either special cases hack solutions, have no solution, or involve re-drawing textview
recursively until small enough (which memory intense , forces user watch text shrink step-by-step every recursion).
but i'm sure out there has found solution doesn't involve i'm doing: writing several heavy routines parse , measure text, resize text, , repeat until suitably small size has been found.
what routines textview
use wrap text? couldn't somehow used predict whether text small enough?
tl;dr: there best-practice way auto-resize textview
fit, wrapped, in getheight , getwidth bounds?
with android 8.0 (api level 26) default feature. https://developer.android.com/guide/topics/ui/look-and-feel/autosizing-textview.html
Comments
Post a Comment