Here are the units of measurement supported byAndroid:

(1) px --> Pixels - corresponds to actual pixels on the screen .

(2) in --> Inches - based on the physical size of the screen .

(3) mm --> Millimeters - based on the physical size of the screen .

(4) pt --> Points - 1/72 of an inch based on the physical size of the screen .

(5) 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".

(6) 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. 代码中设置drawableleft
  2. android 3.0 隐藏 系统标题栏
  3. Android开发中activity切换动画的实现
  4. Android(安卓)学习 笔记_05. 文件下载
  5. Android中直播视频技术探究之—摄像头Camera视频源数据采集解析
  6. 技术博客汇总
  7. android 2.3 wifi (一)
  8. AndRoid Notification的清空和修改
  9. Android中的Chronometer

随机推荐

  1. android与sqlite的连接(增、删、查、改)
  2. Android(安卓)如何将定制的Launcher成为
  3. Android软硬整合技术(HAL&Framework)
  4. 用C/C++开发android应用
  5. [转]Android(安卓)xmlns 的作用及其自定
  6. Android获取屏幕分辨率及DisplayMetrics
  7. android-【机型-版本-分辨率】测试点罗列
  8. android以后台service的方式获取GPRS数据
  9. 如何开发一个适配Android和iOS双平台的Re
  10. 浅析 Android(安卓)生命周期(一)