Android device and layout mapping

layout-sw320dp, screen with smallest width of 320dp, usually for phones with screen of 4 to 4.5 inches in diagonal measurement
sample devices: Android One, Samsung S3 mini, etc

layout-sw360dp, screen with smallest width of 360dp, usually for phones with screen of 5 to 5.5 inches in diagonal measurement
sample devices: HTC One M8, HTC One M9, LG G2, Moto G, Moto X, Nexus 5, Samsung Galaxy S5, Samsung Galaxy S6, Sony Xperia Z1 Xompact, Sony Xperia Z2/Z3, Sony Xperia Z3 Compact, etc

layout-sw600dp, screen with smallest width of 600dp, usually for tablets with screen of 7 inches in diagonal measurement
sample devices: Nexus 7, Asus zenpad, Fire 7” Display, Samsung Galaxy Tab 4, etc

layout-sw720dp, screen with smallest width of 720dp, usually for tablets with screen of 10+ inches in diagonal measurement
sample devices: Ausu zenpad 10, HP 10”, etc

Layout folder conventions

layout-sw<N>dp, where sw stands for smallest width, and <N> is where you will replace with the width of the device you are targeting. Smallest width nerver changes, it always refer to the width of the device whether if the device is on portrait or landscape.

layout-w<N>dp, where w stands for available width, and <N> is where you will replace with the avaible width of the device you are targeting. The available width changes as you rotate the device. On portrait, the width will be shorter, on landscape, the width will be longer.

layout-h<N>dp, where h stands for available height, and <N> is where you will replace with the avaible height of the device you are targeting. The available height changes as you rotate the device. On portrait, the height will be longer, on landscape, the height will be longer.

If you support sw360dp, sw600dp and sw720dp devices, then in the res/ folder, you will create folders layout-sw360dp, layout-sw600dp, and layout-sw720dp respectively. When you create a layout file for an Activity or Fragment, you will create the same file within each of these folder, same file name but with different layout contents. By doing this, when the app starts, Android will automatically pick the corresponding layout for the device it is running on.

All of the above rules also apply for drawable resources.

References

Search within Codexpedia

Custom Search

Search the entire web

Custom Search