Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Different design for landscape and portrait orientation android

Can we have a different xml for landscape and different xml for portrait orientation?

I am working on a simple app, have few buttons and textviews, the xml looks good in portrait, But with same xml when I check the landscape orientation, design doesn't look good.

Any suggestions are appreciated.. Thank you.

like image 346
Adarsh H S Avatar asked Oct 08 '12 12:10

Adarsh H S


2 Answers

Yes ofcourse.

You will have to create two versions of xml files and put in layout-port and layout-land folder inside res folder.

eg :

res/layout [Portrait Mode; default]
 main.xml
res/layout-land [Landscape Mode]
 main.xml 

You can refer further more on the same at http://developer.android.com/training/basics/supporting-devices/screens.html

like image 62
Kartik Domadiya Avatar answered Oct 17 '22 17:10

Kartik Domadiya


If you want to make another layout for landscape then put it in

res -> layout-land folder .

Both the names of the xml are must be same for which is used for portrait and landscape .

like image 35
Chirag Avatar answered Oct 17 '22 16:10

Chirag