1

I made 2 layout , the first one for android 2.1 ( I need it only in portrait) and second one for android 3 ( I need it only in landscape) and these 2 layout use one class . now how can i set these two layout on landscape and portrait? if i set it in AndroidManifest , i can just use one of these mode portrait or landscape , just it ,

we can't use:

<activity android:name=".activity" android:screenOrientation="portrait"></activity>

now which method is true?

Thanks

Mr.James
  • 376
  • 2
  • 8
  • 25

2 Answers2

0

It's just not necessary to set screenOrientation attribute, remove it and you'll be fine.

Egor
  • 39,695
  • 10
  • 113
  • 130
  • 1
    yup that's right but in android 2.1 i need it only in portrait and in android 3 i need it only in landscape!!! – Mr.James Jul 01 '11 at 11:36
  • You can choose what layout to set as content view in code, depending on what version of OS device is using. Check this link to know how to check device's version: http://stackoverflow.com/questions/5919267/android-how-to-check-version – Egor Jul 01 '11 at 11:46
0

its rely not necessary to set screen Orientation attribute.

i am also handle this senario in my project. you make two folder in resours

first for portraitemode and second for landscape maode

like layout folder and layout-land folder

layout---store all layout when u wann give in portraitr mode layout-land----store all layout when u wann give in landscape mode

Rajesh Sharma
  • 573
  • 1
  • 5
  • 15