Let your app have a good user experience on different screen sizes, and you should create a unique XML layout file for each screen size you want to support. Each layout file should be stored in the appropriate resource directory, with the directory name suffix-<screen_size>. For example, the name of a layout directory that holds a large screen is res/layout-large/.
Tip: The Android system will automatically scale the layout to properly fit the screen. So you don't have to worry about the actual size of the UI elements you're designing for different layouts, you need to be aware of the layout structure that affects the user experience (for example, the size and location of the layout next to the important layout).
For example, this project includes a default layout directory and a layout directory for large screens: Myproject/res/layout/main.xml layout-large/ Main.xml
The filenames must be exactly the same, but their content is not the same, to provide the best UI presentation for different screen sizes.
Simply refer to the layout in your app: @Override protected void OnCreate (Bundle savedinstancestate) {super.oncreate (savedinstancestate); Setcontentview (R.layout.main); }
The system will add a layout file to the appropriate layout directory based on the device's screen size. For more information on choosing the appropriate layout resource, see Providing Resources guide.