English subtitles

← Images for Different Densities - Developing Android Apps

Get Embed Code
10 Languages

Showing Revision 16 created 05/25/2016 by Udacity Robot.

  1. Beto mentioned that we should provide
    bitmaps at different resolutions.
  2. In our app, the 48dp icon on the Nexus S
    looks to be about the same size
  3. as on the Nexus 4, and on the Nexus 5.
  4. However, in reality, this asset
    that's being displayed,
  5. is actually a lot bigger
    in terms of pixels
  6. compared to this one.
  7. To confirm, we can check out
    the app resource folders.
  8. In the drawable folders, we see that
    our app has a 48 x 48 pixel launcher icon
  9. for mdpi devices located
    in the drawable mdpi folder.
  10. To make an equivalent icon,
    for the higher density devices,
  11. we need to make that icon
    progressively larger.
  12. To know exactly how big
    to make these images
  13. and what the dp pixel
    conversion should be,
  14. we use an mdpi device as the baseline.
  15. This is where one dp equals one pixel.
  16. Then on the HDPI device,
    one dp equals 1.5 pixels.
  17. And then it increases from there,
    all the way to an XXHDPI device,
  18. where one dp equals four pixels.
  19. For more info on the conversions,
    see the link below.
  20. Following those rules, these are
    the sizes of the launcher icon
  21. in our drawable folders.
  22. The MDPI one is 48 pixels x 48 pixels.
  23. The one for HDPI is
    1.5 times the size of this one.
  24. For an XHDPI device, the icon
    is two times the size of the MDPI one,
  25. And for an XXHDPI device, the icon
    is three times the size of this one.