I have a couple textviews, I would like to limit them to a certain visual length, say 50% width of screen. If the text reaches 50% of the screen, I would like to do something t开发者_运维问答o stop it from continuing across the screen. I thought maybe if it hits that limit, to just decrease the textsize for every character so that it fits.
How would I do that... or is there a better way to handle this?
Do you want to limit the text, or the view itself? I suppose the latter.
You can either look at android:maxWidth
(which takes several kinds of parameters - pixels, dp, etc.), or you can arrange multiple TextViews in the same row by giving them a weight with android:weight
. It depends on what your entire layout is like, and how you want your views to relate to each other in size.
精彩评论