Layout for all screen sizes [duplicate]

2

I started briefly with android and I had a big question. How do I make a layout to work on all screen sizes?

As I researched, there are specific layout folders for each size. So how do I create these folders, since in Android Studio comes only with a "layout" folder.

Another question, done this, how will my application know which layout to open?

    
asked by anonymous 14.07.2015 / 20:40

3 answers

1

Just create the folders on the same level as the layout and create the inside file with the same name. Android will check the screen size and get the layout in the corresponding folder.

It's your job to just write the layout files for each dimension and put them in the right folders

The same goes for the folder drawable

    
14.07.2015 / 20:57
1

Hello. I recommend you first read this google article: Supporting multiple screen sizes . I'm sure that after reading all this tutorial (you can put it on google translator) you will not have any doubts.

You basically have to resize your images to pre-defined sizes by Google. Android underneath the cloths, choose the ideal size automatically based on your phone's screen!

    
15.07.2015 / 22:47
0

Is there a default for folder names? So, is not the following code unnecessary? Because it was the only way I had found to solve my problem

if (config.screenWidthDp  == 720) {
            setContentView(R.layout.layout_720x1280);
 }
    
14.07.2015 / 21:07