如何让自己开发的android支持多种不同的手机屏幕(supporting Multiple Screens)

转换式为:px=dp*(dpi/160)       

其中px为最终显示的像素数目;dp为density-independent pixel,即A virtual pixel unit that  you should use when defining   UI layout, to express layout dimensionsor position in a density-independent way. The density-independent pixel is equivalent to one physical pixel on a 160 dpi screen, which isthe baseline density assumed by the system for a "medium" density screen. At runtime, the systemtransparently handles any scaling of the dp units, as necessary, based on the actual density of thescreen in use. The conversion of dp units to screen pixels is simple:

px = dp * (dpi / 160) .;dpi为目标手机的实际像素密度(Screen density)

证明:设两个不同屏幕上的一段等长距离a,原始图对应width值为dp,目标屏幕密度为dpi,最终在屏幕显示的像素数目为x,则有a=dp/160=x/dpi。变形即有所示转换式。




原文链接


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值