The best guide I have found to provide the correct pixel-sized images for every density in an Android project is by Anup Cowkur.

In a post in the StackOverflow forum, he notes that you have to create multiple resources for your app. Android has 4 resolutions (ldpi,mdpi,hdpi and xhdpi) and 4 generalized screen sizes (small, medium, large and extra large). So you have to make 4 layouts (or 3 if you don’t plan on supporting tablets, since tablets come under the extra large category) to support the screen sizes.

For pixel-sized resolution, here is a calculation he provided which can greatly help into providing high quality drawables according to density.

  • ldpi is 0.75x dimensions of mdpi
  • hdpi is 1.5x dimensions of mdpi
  • xhdpi is 2x dimensinons of mdpi

Android will automatically select the best combination of layout and image depending on the device. So it does not mean that you have to create a drawable for each density folder including those for tablets.

This guide was really helpful in enabling me to provide the correct image sized drawables.

Related Posts Plugin for WordPress, Blogger...