android dp 与 px 的换算


Density-independent pixel (dp)

The density-independent pixel is equivalent to one physical pixel on a 160 dpi screen, which is the baseline density assumed by the system for a "medium" density screen. At runtime, the system transparently handles any scaling of the dp units, as necessary, based on the actual density of the screen in use. The conversion of dp units to screen pixels is simple:  px = dp * (dpi / 160) . For example, on a 240 dpi screen, 1 dp equals 1.5 physical pixels. 

1 dp 相当于 在 160 dpi 的屏幕上的 1 个像素 px。单位 dp 到 px 的转化很简单: px = dp * (dpi / 160) 。例如在 240 dpi 的屏幕上,1 dp = 1.5 px


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值