当前位置:网站首页>【快应用】px和vp单位换算
【快应用】px和vp单位换算
2022-07-16 10:52:00 【华为开发者论坛】
【问题背景】
在快应用页面布局设计时,需要知道每个组件的样式及位置,这时就需要了解下长度单位及相互转换方法。
【解决方案】
px是长度单位像素,是显示屏中的一个个小方格。
vp(虚拟像素)
vp=(px*160)/PPI
屏幕像素点密度(Pixels Per Inch-PPI):对角线像素点个数/屏幕尺寸。即每英寸中有多少个像素点。
代表的分辨率 | 屏幕密度 | 换算(px/vp) |
240*320 | 120 | 1vp=0.75px |
320*480 | 160 | 1vp=1px |
480*800 | 240 | 1vp=1.5px |
720*1280 | 320 | 1vp=2px |
1920*1280 | 480 | 1vp=3px |
例如:
当分辨率为1080*2340时,该分辨率与1920*1080相近,可以按三倍来粗略估计,将200px转换成67vp,显示出的结果并无太大影响。但如果想要精确,就需要用上面的公式计算了。因为是粗略计算,故可能不是很准,但是像素丢失或多出几个并没有太大影响。
欲了解更多更全技术文章,欢迎访问https://developer.huawei.com/consumer/cn/forum/?ha_source=zzh
边栏推荐
- 美国压力激增 TikTok更换全球安全主管
- 面试官:怎么不用定时任务实现关闭订单?
- 链表 - 【删除所有重复的元素】
- [record of question brushing] 12 Integer to Roman numeral
- ONEFLOW source code list: GDB compilation and debugging
- Apple commercial website blocks Firefox browser
- 從 URL 輸入到頁面展現到底發生什麼?
- 重装mysql后initializing database错误
- 健康防猝指南2:饮食健康
- Summer behavior reward for postgraduate entrance examination top5
猜你喜欢

Apple commercial website blocks Firefox browser

可爱的图像分类——《CNN模型中常见的flops到底是什么》一文通解

Best practice path for problem solving

我发现了一款高效管理接口文档的神器

SAP Fiori Launchpad 上看不到任何 tile 应该怎么办?

藏红花是否会成为用于关节炎患者的安全和有效的自然疗法?

OSPF(Open Shortest Path First开放式最短路径优先)防环以及计算错误带来的组网应用隐患

Aardio - 【库】图形化的分页组件库

考研人暑期行为大赏top5

Interviewer: how can you close an order without using a scheduled task?
随机推荐
Debugging of diagnostic function of analog power amplifier 75610
vscode 1.69变化与关注点(三路合并/终端集成等)
US pressure surges tiktok changes global safety director
What does software testing need to learn? What skills do test engineers with an annual salary of 30w+ need to master?
【HMS core】【Wallet Kit】【解决方案】华为钱包的客户端示例代码为何无法运行
Building vector database from scratch: source code compilation and installation of Milvus (II)
Economic Daily praised Hongji, a leading RPA enterprise, for helping financial institutions with their digital transformation
藏红花是否会成为用于关节炎患者的安全和有效的自然疗法?
OPPO、一加将在德国禁售?原来是被“专利流氓”诺基亚盯上了!
Interviewer: how can you close an order without using a scheduled task?
链表 - 【删除所有重复的元素】
用c语言组合排列实现0-10的奇数问题——原创
mysql 数据库存储引擎怎么选择?快来看看性能测试吧
健康防猝指南2:饮食健康
The use of finally in JS
[record of question brushing] 12 Integer to Roman numeral
String and memory functions
Uncaught Error: Rendered fewer hooks than expected. This may be caused by an accidental early return
INSET: Sentence Infilling with INter-SEntential Transformer
Online sql to yaml tool