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.
source
share