Android Tips, Techniques and Theory

PART 1: Creating Content with XML with Android Studio (No programming required)

With Simple Recipes

Go Back To TOC


Screen Size and Density

Screen Size

Screen size is measured diagonally and falls into four categories:

  1. Small (2-3.7 inches)
  2. Normal (3.7-4.3 inches)
  3. Large (4.3-7.1 inches)
  4. Extra Large (7-10 inches - mostly tablets)

Screen Density

Screen density (number of pixels in a given area) also falls into four categories. DPI is dots/inch.

  1. Low density - ldpi - (100-130 dpi)
  2. Medium density - mdpi - (120-180 dpi)
  3. High density - hdpi - (180-280 dpi)
  4. Extra High density - xhdpi - (280-360 dpi)

At runtime, dp is converted into pixels using the following formula: px = dp * (dpi / 160)

[Replace with my own graphics]

Using the formula above:

[Update with my own example]

App Icon Dimension

You have to create five versions of the app icon from the varies densities that are housed in individual mipmap folders.

The ratios between the dpi are:

ldpi : mdpi : hdpi : xdpi
3 : 4 : 6 : 8

Background Image Dimension

You have to create five versions of the image background from the varies densities that are housed in individual drawable folders.

The ratios between the dpi are:

ldpi : mdpi : hdpi : xdpi
3 : 4 : 6 : 8

Mipmap Folders

It’s best practice to place app icons in the mipmap folders (not the drawable folders) because they are used at resolutions different from the device’s current density.

Drawable Folders

All other images are stored in the following folders:

Layout Folders

All xml layout files are stored in the following folders: