AndreaF
AndreaF

Reputation: 12385

How to do a proportional scaling of various TextView

I have a ScrollView with various different TextView. I have used sp as unit for text, however I cannot get a good visual result for all screen sizes.

I can only find the perfect textsize for a single sceen size, if I try to find a size too show a good result on different screen size, whatever sp size I try to use for the text is always too small for a large display with too blank space, or too big for smaller screens,

see this sample(too blank space on the right image (and large screens)) enter image description here

I have seen some implementations of AutoFit Twextview, but this is not a good option since the different lenght of the various text lines cause every lines use a different text size with a bad aesthetic result. I need a praticable way to scale proportionally all TextView

Upvotes: 1

Views: 139

Answers (1)

Manmohan Badaya
Manmohan Badaya

Reputation: 2336

Use style for textview - style as

 <style name="MyDefaultTextAppearance" parent="@android:style/TextAppearance">    
 <item name="android:textSize">12sp</item>     
<item name="android:textColor">#333</item>    
 <item name="android:textStyle">bold</item>   
</style> 

put it with same keys and different values in styles.xml in various values folder as u required.folder name such as values , values-v11 , values-sw600dp etc and see results

Upvotes: 1

Related Questions