当前位置:网站首页>How big is 1dp!
How big is 1dp!
2022-08-08 17:18:00 【Wholehearted】
Why is 1dp a fixed length?How long is it?
Why do you say px is a relative length, if you don't know dpi, you don't know how long it is.
First of all, we have to distinguish a concept
Control, text, we use dp, sp, so on different devices, it will be converted into corresponding px according to the dpi of the device
Therefore, it is guaranteed to be the same size on different devices.
For example, how big is 1dp
1dp runs on a 160dpi machine, then 1dp=1px and knowing that dpi=160 means that there are 160 pixels per inch, then the length of a pixel is 1/160 of an inch.
And 1dp runs on a 320dpi machine, then 1dp=2px knows dpi=320, that is, the length of a pixel is 1/320 inch, to display a 1dp control requires 2px, then the length is 2*1/320 Still yes1/160 of an inch, so the length is fixed.
As for the picture, since the unit of the picture is px, it needs to be adapted. It is necessary to create different folders according to different devices, and store the different pixel sizes of the same picture in different folders. When the real machine is runningThe pictures in the appropriate folder will be loaded according to the dpi of the real machine.
And if you only have one image, the px size is fixed. Naturally, when running on different devices, the displayed size of this image is different.
边栏推荐
猜你喜欢
随机推荐
C#异步和多线程
JVM-简介&垃圾回收&内存泄漏分析
DSPE-PEG-NH2,DSPE-PEG-amine,474922-26-4,磷脂-聚乙二醇-氨基科研试剂
win10如何设置定时联网断网辅助自律
KITTI数据集简介(一)—— 传感器介绍
【20210923】选择感兴趣的研究方向?
目标检测、目标跟踪、图像分类最新进展
使用train_test_split划分训练数据集、测试数据集
对于端口的粗浅理解
laravel数据库: 查询构造器
数字图像处理(六)—— 图像压缩
【数学模型】灰色关联分析
L2-025 分而治之 (25 分)
数据库分析与优化
L2-012 关于堆的判断 (25 分)(堆)
Acwing Week 63 [Unfinished]
题目:有序队列
The new version of squirrel as source change operation
【 8.7 】 source code - card to LCM with GCD 】 【 】
JVM内存模型和结构详解(五大模型图解)