Android - UI

Android UI:

在之前的版本中,只有一个drawable,而2.1版本中有drawable-mdpi、drawable-ldpi、drawable-hdpi三个,这三个主要是为了支持多分辨率。

  drawable- hdpi、drawable- mdpi、drawable-ldpi的区别:

  (1)drawable-hdpi里面存放高分辨率的图片,如WVGA (480x800),FWVGA (480x854)

  (2)drawable-mdpi里面存放中等分辨率的图片,如HVGA (320x480)

  (3)drawable-ldpi里面存放低分辨率的图片,如QVGA (240x320)

  系统会根据机器的分辨率来分别到这几个文件夹里面去找对应的图片。

  在开发程序时为了兼容不同平台不同屏幕,建议各自文件夹根据需求均存放不同版本图片。

  1. Conversion of Density-independent pixel (dp): px = dp * (dpi / 160). A proper way to design a UI is dp in order to fit different densites
  2. Range of actual screen sizes and desites:
    • A set of four generalized sizes: small, normal, large, and xlarge
    • A set of four generalized densities: ldpi (low), mdpi (medium), hdpi (high), and xhdpi (extra high)

  1. How to solve this problem:
    1. Declare it explicitly in the manifest which screen sizes your application supports
    2. Place different bitmaps drawables for different screen densites like drawable-hdpi/.

    1. Provide different layouts for differe screen sizes(maybe its the best way).You can use it by 

      sw<N>dp. 

       

你可能感兴趣的:(UI,android)