Android中的尺寸:densityDpi,heightPixels,widthPixels,scaledDensity,xdpi,ydpi

本文详细介绍了Android DisplayMetrics中的尺寸类型,包括densityDpi、xdpi、ydpi、widthPixels和heightPixels等参数,并列举了创维电视、小米盒子、华为P30和vivo V1924A等设备的真机测试数据,揭示了不同设备间的屏幕差异和适配挑战。
摘要由CSDN通过智能技术生成

尺寸类型

以下尺寸来自Android类DisplayMetrics下,描述摘自源码描述。

  • densityDpi:The screen density expressed as dots-per-inch. May be either 120,160 or 240
  • xdpi:The exact physical pixels per inch of the screen in the X dimension.
  • ydpi:The exact physical pixels per inch of the screen in the Y dimension.
  • widthPixels:The absolute width of the available display size in pixels.
  • heightPixels:The absolute height of the available display size in pixels.
  • scaledDensity:A scaling factor for fonts displayed on the display. This is the same as density, except that it may be adjusted in smaller increments at runtime based on a user preference for the font size.

真机测试

  • 创维电视(Q60):xdpi: 159.895–ydpi:160.421-densityDpi:240-density:1.5-width:1920-height:1080
  • 小米盒子(型号未知):xdpi: 160.0–ydpi:160.0-densityDpi:320-density:2.0-width:1920-height:1080
  • 华为p30: xdpi: 422.03–ydpi:421.531-densityDpi:480-density:3.0-width:1080-height:2265
  • vivo V1924A: xdpi: 365.76–ydpi:362.673-densityDpi:440-density:2.75-width:1080-height:2140
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

陈德山

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值