Android: Multiple Image Density support - scale height width and dpi?

后端 未结 4 1021
我寻月下人不归
我寻月下人不归 2021-02-20 00:17

I have an android app that I\'m trying to add support for different densities, screen sizes, etc. I\'ve developed the app on the simulator with the HVGA support and used all ic

相关标签:
4条回答
  • 2021-02-20 00:55

    For me as a Graphic Artist of a Mobile Development Company, I made UI's for Android in this dimension:

    HDPI : 640px x 960px in 300dpi optimized by 75%
    MDPI : 640px x 960px in 300dpi optimized by 50%
    LDPI : 640px x 960px in 300dpi optimized by 25%

    0 讨论(0)
  • 2021-02-20 01:09

    Take a look at Providing Resources.

    There is a section there on "Screen pixel density (dpi)". You are correct that you just scale your width and height for the resources. A 90 pixel image at ldpi becomes a 120 px a mdpi, a 180 at hdpi and a 240 ad xhdpi.

    You are also right that the 800 isn't 1.5 x the base 480 height. The reason for that is that these are all approximates based on targets for each density. The phone os lies to the applications running on it about its actual height and width and scales the resources to match the exact dimensions of the handset, since it can vary. This is my understanding.

    0 讨论(0)
  • 2021-02-20 01:13

    I recently solved this problem by generating many PNGs of different sizes from a SVG vector image. These are the ratios I used for screen pixel densities and screen sizes:

    • ldpi:mdpi:hdpi:xhdpi:xxhdpi <-> 3:4:6:8:12
    • sw320dp:sw360dp:sw480d:sw600dp:sw720dp <-> 8:9:12:15:18

    Putting these two together can give a 5 by 5 table of image size ratios that you need in make your image resources look great on most Android devices' screens. Of course, the downside is that many images will be generated, and the size of your APK will grow.

    Please see http://aleakymemory.blogspot.com/2013/11/a-different-look-at-managing-android.html for the table of image size ratios.

    0 讨论(0)
  • 2021-02-20 01:20

    Everything looks good now but I'm a bit confused after reading the official android documentation.

    Which documentation did you read? Here are some to be going on with:

    • Supporting Multiple Screens
    • Icon Design
    0 讨论(0)
提交回复
热议问题