简体   繁体   中英

How I change textviews textsize for different device automatically?

I add two different devices screen.

First, 10.1 inch:

everything is normal!!!:
一切正常!!!

But the smaller screens, for example 5 inc.

There is problem..:
有问题..

I want textviews textsize automatically changes the best size for the each screen. How can I manage?

You can use dimens.xml like that. enter image description here

set your basic size and set other dimens.xml

<resources>
 <dimen name="dp48_w360">51.200005dp</dimen>
 <dimen name="dp13_w360">13.866668dp</dimen>
 <dimen name="dp7_w360">7.466667dp</dimen>
 <dimen name="dp10_w360">10.666667dp</dimen>
 <dimen name="dp0_5_w360">0.53333336dp</dimen>
 <dimen name="dp26_w360">28.000002dp</dimen>
 <dimen name="dp15_w360">16.0dp</dimen>
 <dimen name="dp22_5_w360">24.000002dp</dimen>
 <dimen name="dp45_w360">48.000004dp</dimen>
 <dimen name="dp133_w360">141.86667dp</dimen>
</resources>

or You'd better using sp.

for more detail, refer to https://android-developers.googleblog.com/2011/07/new-tools-for-managing-screen-sizes.html

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM