Android支持以下度量单位:px,in,mm,pt,dp,dip,sp,以下是它们的具体说明:
You can create common dimensions to use for various screen elements by defining dimension values in XML. A dimension resource is a number followed by a unit of measurement . For example: 10px, 2in, 5sp. Here are the units of measurement supported by Android :

引用 px(像素):屏幕上的点。
px –> Pixels – corresponds to actual pixels on the screen .
引用 in(英寸):长度单位。
in –> Inches – based on the physical size of the screen .
引用 mm(毫米):长度单位。
mm –> Millimeters – based on the physical size of the screen .
引用 pt(磅):1/72英寸。
pt –> Points – 1/72 of an inch based on the physical size of the screen .
引用 dp(与密度无关的像素):一种基于屏幕密度的抽象单位。在每英寸160点的显示器上,1dp = 1px。
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 screen, so one dp is one pixel on a 160 dpi screen. The ratio of dp-to-pixel will change with the screen density, but not necessarily in direct proportion .Note: The compiler accepts both “dip” and “dp”, though “dp” is more consistent with “sp”.
dip(设备独立像素):与dp相同,不同设备有不同显示效果,多用于android/ophone示例中。

引用 sp(与刻度无关的像素):与dp类似,但是可以根据用户的字体大小首选项进行缩放。
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 user’s preference

更多相关文章

  1. Android 密度转换 java文件
  2. Android计量单位px,in,mm,pt,dp,dip,sp和获取屏幕尺寸与密度
  3. Android 实现缩小图片像素
  4. Android中屏幕密度和图片大小的关系分析
  5. Android色彩空间像素格式定义及设定
  6. Android 尺寸单位转换和屏幕适配相关
  7. Android 密度转换多分辨率
  8. Android系统信息获取 之十二:获取屏幕分辨率及密度

随机推荐

  1. Android(安卓)通用的下拉刷新,重温事件传
  2. Android中Spinner的使用
  3. 怎样使用Android(安卓)studio将极光推送
  4. Android 导入项目时报Android.jar包丢失
  5. 浅析android系统设计中的回调思想
  6. Android中Adapter用法总结
  7. Android - Handler 、AsyncTask(一)
  8. Android——AS VS Eclipse
  9. Android NDK探究奥秘一:Android Studio创
  10. Android中执行java命令的方法及java代码