Android layouts for different screen sizes

The answer is already given by user5594218 but looks like you are still unclear. (maybe you are beginner)

So, here is the step by step guideline

Solution 1: (short and simple)

  1. Navigate to app > src > main > res

  2. Duplicate layout directory by copying and pasting

  3. Rename duplicated Directories e.g layout-sw300dp

Solution 2: (bit lengthy)

  1. Create new resource directory: res > New > Android resource directory

Create new resource directory

  1. Select Resource Type as layout

  2. Add sw<N>dp in Directory name e.g layout-sw300dp and Hit OK

enter image description here

  1. Navigate to app > src > main > res

  2. Copy layouts XML file inside new directory

    //repeat process for other qualifiers
    

List of Qualifiers to support all screens:

  • layout-sw300dp
  • layout-sw330dp
  • layout-sw480dp
  • layout-sw600dp
  • layout-sw720dp

Testing:

This is how it gonna look like, if you did it right.
enter image description here

For more detail and examples, check: Android Application Development All-in-One For Dummies

Leave a Comment