0

I would like to ask why is that my android emulator always displays on landscape even though I have a android:orientation="horizontal" on my code here is my screenshot

enter image description here

and when I change it to portrait mode using ctrl + f11 it is still on landscape mode.

  • Android Manifest

`

    <uses-sdk
        android:minSdkVersion="8"
        android:targetSdkVersion="19" />

    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >

        <activity
            android:name=".Splash"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

        <activity
            android:name=".Menu"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="com.project.billmoko.MENU" />

                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
        </activity>

        <activity
            android:name=".Calculation"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="com.project.billmoko.CALCULATION" />

                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
        </activity>

        <activity
            android:name=".Instruction"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="com.project.billmoko.INSTRUCTION" />

                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
        </activity>

        <activity
            android:name=".Tips"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="com.project.billmoko.TIPS" />

                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
        </activity>

        <activity
            android:name=".BillingCenter"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="com.project.billmoko.BILLINGCENTER" />

                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
        </activity>

        <activity
            android:name=".AboutUs"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="com.project.billmoko.ABOUTUS" />

                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
        </activity>

    </application>

</manifest>`
  • XML File

    <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@drawable/background2" android:screenOrientation="portrait" >

Aldy
  • 83
  • 1
  • 10

2 Answers2

0

Please try replacing "horizontal" with "portrait". If that doesn't work please post your manifest, or at least the activity part of it. Note that this is an activity-specific attribute, not application. If you want all your activities to have one specific orientation you need to set this attribute in each one in the manifest.

Good luck!

William T. Mallard
  • 1,562
  • 2
  • 25
  • 33
  • I just tried it and still the same everytime the Android emulator starter it goes in landscape mode even in the home menu of the emulator – Aldy Jul 01 '14 at 01:19
  • Well done! Two things: A) The attribute screenOrientation is an attribute of Activity, so take it out of the layout file and put it in each Activity element that you want to be portrait oriented in your app's manifest. B) If your emulator home screen starts out rotated then it's an emulator issue (although you still need to change your code). Check this link for a question on [rotating the emulator](http://stackoverflow.com/questions/4535298/how-to-rotate-the-android-emulator-display). Let me know if you're still having trouble after that. – William T. Mallard Jul 02 '14 at 03:01
  • Also check your accessibility settings in your emulator. There's one called "Auto-rotate screen". Most people leave this off, so that's how I would recommend you do your testing. – William T. Mallard Jul 02 '14 at 03:14
0

Have you use the Google APIs with the Emulator, you can try to change the Google APIs to normal Android API. May the two answers help you

Community
  • 1
  • 1
penkzhou
  • 1,200
  • 13
  • 30