In your project's res/
directory, you would include layout folders for each screen size you support. The possible folder names would be layout-small
, layout-normal
, layout-large
and layout-xlarge
. If you omit one or more screen size folders, Android will use the next closest folder that is equal to or less than that size, and it is also recommended that you have a "default" folder simply called layout
that can be used as a catch-all (recommend using this instead of layout-small
). Inside each folder you would generally place an xml layout file specific to that screen size and all of the files would have exactly the same name (ex. layout-normal/my_layout.xml
, layout-large/my_layout.xml
, etc.).
From within your Activity
's onCreate()
method you would call setContentView(R.layout.my_layout)
, which would automatically select the correct layout from the folder matching the screen size of the device.
Here is a very comprehensive document that explains designing applications for different screen sizes, includes the information mentioned above.