differences between dp , sp, px, pt
来源:互联网 发布:捷速扫描文字识别软件 编辑:程序博客网 时间:2024/06/05 04:09
A dimension value defined in XML. A dimension is specified with a number followed by a unit of measure. For example: 10px, 2in, 5sp. The following units of measure are supported by Android:
dp
- Density-independent Pixels - An abstract unit that is based on the physical density of the screen. These units are relative to a 160 dpi (dots per inch) screen, on which 1dp is roughly equal to 1px. When running on a higher density screen, the number of pixels used to draw 1dp is scaled up by a factor appropriate for the screen's dpi. Likewise, when on a lower density screen, the number of pixels used for 1dp is scaled down. The ratio of dp-to-pixel will change with the screen density, but not necessarily in direct proportion. Using dp units (instead of px units) is a simple solution to making the view dimensions in your layout resize properly for different screen densities. In other words, it provides consistency for the real-world sizes of your UI elements across different devices.
sp
- Scale-independent Pixels - This is like the dp unit, but it is also scaled by the user's font size preference. It is recommend you use this unit when specifying font sizes, so they will be adjusted for both the screen density and the user's preference.
pt
- Points - 1/72 of an inch based on the physical size of the screen.
px
- Pixels - Corresponds to actual pixels on the screen. This unit of measure is not recommended because the actual representation can vary across devices; each devices may have a different number of pixels per inch and may have more or fewer total pixels available on the screen.
mm
- Millimeters - Based on the physical size of the screen.
in
- Inches - Based on the physical size of the screen.
Note: A dimension is a simple resource that is referenced using the value provided in the name
attribute (not the name of the XML file). As such, you can combine dimension resources with other simple resources in the one XML file, under one <resources>
element.
- differences between dp , sp, px, pt
- Android px pt dp sp...
- px、pt、dp、dip、sp
- px、pt、dp和 sp
- android dp、sp、px、pt
- px、pt、dp 和 sp
- dp,sp,px,pt区别
- dp,dpi,px,pt,sp
- px, in, mm, pt, dp, dip, sp
- px,in,mm,pt,dp,dip,sp
- [android] 单位dp、px、pt、sp
- Android尺寸dp,px,pt,sp
- Android 中的dp,px,pt,sp比较
- Android px,dp,pt,sp的区别
- dip、dp、sp、pt和px
- px dp sp in dpi pt
- dpi ppi px pt dp sp区别
- dp、sp、px、dpi、ppi、pt详解
- Xcode学习笔记---ViewController的相关说明
- mysql基础操作
- android 命令行输出日志
- 使用PXE+DHCP+Apache+Kickstart无人值守安装CentOS5.8 x86_64
- eclipse修改字体
- differences between dp , sp, px, pt
- tomcat下配置https环境
- Dijkstra 证明
- [leetcode]Best Time to Buy and Sell Stock
- oracle中高水位(HWM)的问题
- 十进制转换为十六进制
- [leetcode]Best Time to Buy and Sell Stock II
- 9 STL算法
- Ubuntu sudo 免密码之 sudoers 修改