tags:

views:

47

answers:

1

Hi Friends

i am writing two xml files for landscape and portrait and create res/layout-land folder,execute my code but did not work portrait mode,have any setting set for work my code for landscape and portrait..please give any sample code for that.

Thanks All

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="com.landimage.example"
      android:versionCode="1"
      android:versionName="1.0">
    <application android:icon="@drawable/icon" android:label="@string/app_name">
        <activity android:name=".landimage"
                  android:label="@string/app_name">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>
    <uses-sdk android:minSdkVersion="4" />
</manifest> 
+1  A: 

By default Android will manage your layout automatically when you switch between landscape and portrait. If this causes problems for you or doesn't look right then you can always specify separate layouts:

res/layout/somePage.xml
res/layout-land/somePage.xml

Are your XML files named the same in both folders? What is happening exactly, is it crashing? is it not rotating? Do both files contain the same Views with the same IDs so your code can access them no matter which one is loaded?

Dan