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

后端 未结 4 943
我寻月下人不归
我寻月下人不归 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 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.

提交回复
热议问题