当前位置:网站首页>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.
边栏推荐
- APICloud AVM wraps date and time selection components
- 【LeetCode】试题总结:深度优先搜索 (DFS)
- C. Palindromifier
- Is it safe to open an account with CICC Wealth?How does it work?
- 【 8.7 】 source code - card to LCM with GCD 】 【 】
- The latest research from PNAS: 81% problem solving rate, neural network Codex opens the door to the world of advanced mathematics
- 中金财富开户安全吗?怎么操作?
- R文件找不到问题
- 钱放在股票账户安全吧?
- MySQL 表的增删查改
猜你喜欢
随机推荐
产品经理常用的19类50+工具软件盘点
XDOJ-统计正整数个数
Chapter 20 Source Code File REST API Reference (2)
MySQL 数据库
【LeetCode】Exam Summary: Depth-First Search (DFS)
【20210923】Choose the research direction you are interested in?
10 种最佳 IDE 软件 ,你更忠爱哪一个?
Are Huishang Futures official and reliable?Is it safe to open an account in Huishang Futures?
D. Districts Connection
L2-025 分而治之 (25 分)
mysql进阶(二十九)常用函数汇总
laravel database: query builder
Charles MOCK 数据 htpps代理
C#异步和多线程
The latest research from PNAS: 81% problem solving rate, neural network Codex opens the door to the world of advanced mathematics
李沐:机器学习者进阶学习建议
C语言每日一练——Day01:求最大公约数(三种方法)
KITTI数据集简介(一)—— 传感器介绍
DSPE-PEG-FITC,Fluorescein-PEG-DSPE,修饰性PEG磷脂-聚乙二醇-荧光素
史上最强IDEA工具使用教程,你想要的全都有!

![Acwing Week 63 [Unfinished]](/img/ad/aee803fddbba688366ca8f3e772764.png)







