Android: screenorientation attribute (set landscape and landscape)

Source: Internet
Author: User
In the development of Android applications, you sometimes need to restrict horizontal and vertical screen switching. You only need to add the Android: screenorientation attribute restriction to the androidmanifest. xml file.
  1. Android: screenorientation="Landscape"Is to restrict the horizontal display of this page,
  2. Android: screenorientation="Portrait"Is to limit the number of faces on this page to be displayed on the vertical screen.
[HTML] View
Plaincopy

  1. Android: screenorientation = " Landscape " restrict the horizontal display of this page,
  2. Android: screenorientation="Portrait"Is to limit the number of faces on this page to be displayed on the vertical screen.

 


Android: screenorientation: sets the direction of the activity. The value can be any of the following strings:

"Unspecified"
-The default value is selected by the system to indicate the direction. Different settings may vary.

"Landscape"
-Forward Direction

"Portrait"
-Forward Direction

"User"
-Use the marker as the first choice.

"Behind"
-Same direction as the activity under the active action heap

"Sensor"
-The root node determines the direction of the sensor in the physical direction. It determines the direction in which the camera is used. When the camera is used, it changes with the camera.

"Nosensor"
-The direction is determined by the sensor without the physical direction. the sensor is ignored, so when we use the dynamic configurator, it indicates that it will not change with changes. except this region, the system selects the same policy orientation for "unspecified" settings. system root selection "unspecified" ("unspecified") sets the same direction for selection.

To make the View Interface of the activity full screen, you only need to hide the top signal bar and the title bar of the activity.Code:

Requestwindowfeature (window. feature_no_title );
  1. Code in the configuration file:
  2. Android: Theme = " @ Android: style/theme. notitlebar "
  3. Code for hiding the signal bar:
  4. Getwindow (). setflags (windowmanager. layoutparams. flag_fullscreen, windowmanager. layoutparams. flag_fullscreen );
  5. Other usage:
  6. Getwindow (). setflags (windowmanager. layoutparams. type_status_bar, windowmanager. layoutparams. type_status_bar );
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.