Autosizing text in TextView on Android
Is it poss开发者_如何转开发ible to set TextView
's text size to be the same as TextView
height, when TextView height isn't predefined(WRAP_CONTENT
or FILL_PARENT
)?
solution : Auto Scale TextView Text to Fit within Bounds
i also wanted to do something like this and the closest you can seem to get is to say android:textSize=20dp
(or whatever size you think is appropriate) for either your style or each element that is displaying text. since dp
is device independent pixels, if it appears to be taking up the whole screen on your device, then it is supposed to appear that way on all other devices too. you might want to check on this as you might have to choose a different dp value for each of the different size/density combinations possible (depending on what kind of devices you are aimed at, also whether you are allowing the use to change the orientation) this has all that info.
I've found the library that do exactly what I want : SizeAdjustingTextView
精彩评论