Historically, programmers always designed computer interfaces in terms of pixels. For example, you mightmake a field 300 pixels wide, allow 5 pixels of spacing between columns, and define icons 16-by-16 pixels in size. The problem is that if you run that program on new displays with more and more dots per inch (dpi), the user interface appears smaller and smaller. At some point, it becomes too hard to read. Resolution-independent measurements help solve this problem.
Android supports all the following units:
• px (pixels): Dots on the screen.
• in (inches): Size as measured by a ruler.
• mm (millimeters): Size as measured by a ruler.
• pt (points): 1/72 of an inch.
• dp (density-independent pixels): An abstract unit based on the density of the screen. On a display with 160 dots per inch, 1dp = 1px.
• dip: Synonym for dp, used more often in Google examples.
• sp (scale-independent pixels): Similar to dp but also scaled by the user’s font size preference.
To make your interface scalable to any current and future type of display, I recommend you always use the sp unit for text sizes and the dip unit for everything else. You should also consider using vector graphics instead of bitmaps

dip就是dp

dip是密度不相关像素。为了适应有的屏幕大有的屏幕小。为了达到统一的显示效果。

sp是字体推荐使用的,也会适应手机的字体大小

作为图片最好使用的是矢量图,9.png。而不要使用位图。

更多相关文章

  1. 获取Android设备屏幕的相关参数
  2. Android(安卓)webView自适应屏幕
  3. Android(安卓)设置屏幕亮度
  4. android中的生命周期(新增2个函数)
  5. Android实现悬浮图片
  6. [Android]APP中保持屏幕不自动灭屏的一种方法
  7. Android实现在屏幕上移动图片的方法
  8. android中获取屏幕高宽时的注意事项
  9. Android开发之中英文切换

随机推荐

  1. Android签名文件相关查看和修改
  2. Android(安卓)判断是否能真正上网(避免连
  3. android总结整理----Sqlite
  4. 布局概述之相对布局RelativeLayout
  5. Android 8.0目录介绍
  6. #Android源代码#android:onClick属性的底
  7. Android(安卓)AIDL实现跨进程Activity与S
  8. SmartImageView初接触
  9. Android实现退出时关闭所有Activity的方
  10. Android(安卓)9.0 Launcher启动详解