Create android studio directory

I am working on a project in Android Studio. Whenever I try to create a new resource directory in the default directory /res

, it doesn't appear in the project area, but it does appear in the packages area. How can it be? Also, whenever I try to create a layout (XML) file in the directory being created, the file being created does not fit in the directory I select and want.

Hope this makes sense with an example. I got:

/app/res/layout
/app/res/layout-land
/app/res/layout-large

      

If I create a file in /layout-land

, Android IDE puts it in a directory /layout

.

Any suggestions are appreciated.

+3


source to share


3 answers


When you created the layout-ground folder, it does not appear in the project view, however, if you right click on the res folder and select to show in the project explorer, you can see that the folder was created there as you indicated.



When you add an XML file to this layout folder (copy and paste the XML file into your existing layout folder), the XML file should become visible in the res / layout folder in the project view with (ground) after that means it is a landscape XML file.

0


source


Finally, after a lot of testing trying every button in Android Studio, I knew how to do it.

In my case I wanted to create a layout-port folder and inside that folder there are two xml files: activity_main.xml and detail_activity.xml, but every time I tried to add the generated xml file in the layout folder .



To create the layout_port folder , I needed to right click on the layout-port and then select New -> Layout Resource File as shown below.

enter image description here

0


source


Please see this instruction for different orientations:

enter image description here

enter image description here

You can switch between layouts in the designer, as you can see in the pictures.

-1


source







All Articles