当前位置:网站首页>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. Palindromifier
Qt——获取文件夹下所有子文件名称
以数治企,韧性成长,2022 年中国 CIO 数字峰会成功举行
套接字的概念
D. Non-zero Segments
Are Huishang Futures official and reliable?Is it safe to open an account in Huishang Futures?
laravel database: query builder
LeetCode_二叉树_中等_515.在每个树行中找最大值
dp,dpi,px知识补充
WPF StepBar
L2-021 点赞狂魔 (25 分)
【8.7】代码源 - 【抽卡】【LCM与GCD】
新版松鼠as换源操作
L2-019 悄悄关注 (25 分)
laravel-practice
JVM-简介&垃圾回收&内存泄漏分析
B+树与B-树的区别
Digital image processing (6) -- image compression
ARP协议详解,小白易懂
leetcode:306. 累加数









