Android emulator - screen orientation does not work properly

I created a virtual Android device, 480x800launched it, and since I already found how to change the screen orientation(portrait landscape, CTRL+F11/ CTRL+F12/ KP7/ KP9), I used these keys to change orientation.

But when I try to use one of these keys, the virtual screen rotates 90 degrees, but the orientation does not change. Consequently, the buttons are vertically placed on the screen, as well as all the text. Just like an image that rotates 90 degrees.

How do I get virtual degrees to switch to another layout file (/res/layout-land/activity_entry.xml)? The Eclipse graphical viewer really switches between correctly landscape/portrait.

EDIT
I added this part to the action right below this onCreateOptionsMenu(Menu menu) , but the application does not recognize the change in screen orientation:

@Override
public void onConfigurationChanged(Configuration newConfig) { 
    super.onConfigurationChanged(newConfig);
    Context context = getApplicationContext();
    CharSequence text = "Orientation changed";
    int duration = Toast.LENGTH_SHORT;

    Toast toast = Toast.makeText(context, text, duration);
    toast.show();
}

EDIT 2
When I call this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE)from a method onCreate(), it works well.

+5
source share
4 answers

First, block the number, and then press 7or press 9and change the emulator orientation, and in another way, change the emulator orientation, press ctrl+ f12.

+1
source

Check if any android is installed in the manifest file: screenOrientation in this manifest. If so, delete it and check.

, , Android.

+1

, , , , . , " ".

+1

, . :

Android-

, (19, , ).

17 .

-1

All Articles