规模无关像素 [英] scale-independent pixel

查看:118
本文介绍了规模无关像素的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不知道它是如何转换为像素为单位。例如,如果我给你1​​0SP我的字体大小160 DPI设备,我的字体大小多少像素呢?或者,如果我给你1​​0SP到我的字体240 DPI设备,我的字体大小多少像素呢?

I don't know how it convert to the unit of pixels. For example, if I assign 10sp to my font size on 160 dpi device, how much px of my font size is it ? Or, if I assign 10sp to my font on 240 dpi device, how much px of my font size is it ?

推荐答案

他们只是一样,但他们也考虑到了字体缩放因子的用户将他的设备上。所以,如果他/她离开的字体大小设置为正常,它就像。如果有字体缩放因子,你可以从<一个整体缩放密度href=\"http://developer.android.com/reference/android/util/DisplayMetrics.html#scaledDensity\">DisplayMetrics.scaledDensity.

They're just the same as dip, but they also take into account the font scaling factor that the user sets on his device. So if he/she left font size set to "normal", it's just like dip. If there is a font scaling factor, you can get the whole scaled density from DisplayMetrics.scaledDensity.

(我不得不承认,我只是试图寻找在我的Andr​​oid手机全局设置一些字体大小选项,我找不到它,所以我不知道,如果它是任何使用权了。我缺少的东西?)

(I have to admit I just tried to look for some "font size" option in my Android phone global settings and I couldn't find it, so I wonder if it is of any use right now. Am I missing something?)

这篇关于规模无关像素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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