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的进程与线程模型
  2. Android 性能优化典范(六)
  3. SpannableStringBuilder的使用
  4. 蓝牙协议栈调试记录
  5. android各种组件的监听器
  6. Android -- 跨应用绑定service(AIDL)
  7. Lottie for Android
  8. Android学习心得(七)——SQLite
  9. Android Camera实现方式
  10. Android之系统启动机理