So far I have set up a page into grids which allows the page to adapt to screens of different sizes. I have been told to use different values files but I'd prefer not to. Is there a way I can allow the text to naturally adapt to the screen size?
Use sp
as the unit for your textSize property in the xml file or.
Here you can find a simple example:
http://developer.android.com/training/multiscreen/screendensities.html
or setTextSize at runtime:
http://developer.android.com/reference/android/widget/TextView.html#setTextSize%28float%29
You have to use sp or dp. These units are relative to the screensize.
On TextView set android:layout_width="fill_parent"
instead of wrap_content. Then use sp
in android:TextSize
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.