在手机和平​​板电脑上设置字体大小 [英] Set font size on phone and tablet

查看:206
本文介绍了在手机和平​​板电脑上设置字体大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何设置手机和平板电脑上textview的字体大小。我提到的帖子建议创建 dimen.xml 并将它们放在不同的文件夹中,即 values-mdpi values-hdpi values-ldpi 。平板电脑(1024x600)的分辨率会从 values-mdpi 文件夹中选取,手机(320x480)也会从 values-mdpi 文件夹,这使得字体看起来真的很大,在手机上扭曲,而在平板电脑上看起来很好。



有什么方法可以指定字体大小分别为手机和平板电脑。

解决方案

对于我使用的平板电脑:


  • values-sw600dp for 7

  • values-sw720dp for 10



这个解析不仅可以用于定位尺寸,还可以用于其他值,样式)。


How to set the font size for a textview in a phone and a tablet. The posts I've referred suggested to creating dimen.xml and placing them in different folders namely values-mdpi,values-hdpi,values-ldpi . The tablet (1024x600) resolution picks from the values-mdpi folder and so does the the phone (320x480) also picks from the values-mdpi folder, this makes the font look really big and distorted on the phone, whereas it looks fine on the tablet.

Is there any way to specify a font size for the phone and tablet separately.

解决方案

For tablets I use:

  • values-sw600dp for 7″
  • values-sw720dp for 10″

This slution can be used not just for localizing dimensions but also other values (for instance, styles).

这篇关于在手机和平​​板电脑上设置字体大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆