Android Studio – layout-land folder not appearing-ThrowExceptions

Exception or error:

I want to support separate UIs for both portrait and landscape mode in my android studio project, for which I need to have a folder with name – ‘layout-land’, to create it I followed below steps:

  1. Right Click on res folder and create a new directory

Creating new layout-land dir

  1. Give name – ‘layout-land’

assigning layout-land name

Problem is- the created folder is not appearing within res folder 🙁

layout-land not visible

I am clueless, please suggest.

How to solve:

That’s the slightly confusing ‘android’ view of Android Studio. It shows only one layout folder (also shows only one drawable folder) which really contains all folders. Switch the view to ‘project’ and you’ll see all folders.

enter image description here

###

I’m posting this just in case anyone really likes Android hirearchy of the project (note: other answers using classic hirearchy are correct as well).

All layout dirs with different qualifiers are categorized under name “layout”. Just right click on the “layout” create your xml with any qualifier you need and you’ll get this hirearchy (image below).

All layout dirs categorized under "layout".

Notice activity_main.xml is not a directorty but a category collecting all activity_main.xml files with different qualifiers.

This categorizing pattern appears quite often in Android hirearchy.

Leave a Reply

Your email address will not be published. Required fields are marked *