GetWindow (). SetFlags (WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); // Set up screen mode Setrequestedorientation (Activityinfo.screen_orientation_landscape); // Force for horizontal screen Setrequestedorientation (activityinfo.screen_orientation_portrait); // Vertical Screen
set the value of android:screenorientation in activity.
the android:screenorientation property has the following values:
unspecified(default, automatically switched by system-determined state), the default value. The system chooses the orientation. The policy it uses, and therefore the choices made in specific contexts, could differ from device to device.
Landscape, horizontal screen
Portrait, vertical screen
User (the orientation value that is currently set by users), the user's current preferred orientation.
behind(the orientation value of the activity to be displayed next), the same orientation as the activity that's immediately beneath it in t He activity stack.
sensor (direction of transducer), the orientation determined by a physical orientation sensor. The orientation of the display depends on what the user is holding the device; It changes when the user rotates the device.
nosensor(without the use of a sensor, this effect is almost equal to unspecified). An orientation determined without reference to a physical orientation sensor. The sensor is ignored, so the display would not be rotate based on how the user moves the device. Except for this distinction, the system chooses the orientation using the same policy as for the "unspecified" setting.
Android Setting horizontal screen vertical screen