-1

I have a small doubt, While developing an Android App whose user interface can be used in both portrait and landscape modes. How it is possible to achieve this? Can someone explain briefly?

Skynet
  • 7,820
  • 5
  • 44
  • 80
Vijaya
  • 101
  • 2
  • 13
  • create a layout-port and layout-land folders and create your xml's there. If you want to make it work differently and want to handle it on code then listen to onConfigurationChanges. – Lalith B Apr 08 '13 at 05:36
  • 2
    look in to this http://developer.android.com/guide/practices/screens_support.html#qualifiers – Sankar V Apr 08 '13 at 05:37

3 Answers3

0

To achieve this you need to create two different xml files with same name for portrait and landscape and put it in respective folders.

MyProject/
    res/
        layout/              # default (portrait)
            main.xml
        layout-land/         # landscape
            main.xml
Chirag
  • 56,621
  • 29
  • 151
  • 198
0

Create 2 xml(GUI) for landscape and portrait. For portrait res/layout And For Landscape res/layout-land . For best ref debv blog Click

Srikanth
  • 584
  • 1
  • 6
  • 21
0

You should have layouts for both landscape and portrait.

  res/layout/main.xml
  res/layout-land/main.xml

http://developer.android.com/guide/topics/resources/providing-resources.html#BestMatch

Raghunandan
  • 132,755
  • 26
  • 225
  • 256