Android about Screen

Source: Internet
Author: User

The activity will re-execute the Oncreat function after the screen switch, but add the android:screenorientation= "user" Android to the Android project Mainfest.xml: After configchanges= "Orientation|keyboardhidden", after the screen switch will not go to execute the Oncreat function, but will call Onconfigurationchanged (), So we can control the switching of the screen.
or in the Res directory to establish the Layout-land and Layout-port directory, the corresponding layout file is unchanged. Layout-land is the horizontal screen of the layout,layout-port is the vertical screen layout.




In the <activity/> tab of the Androidmanifest.xml. There is a property to set the activity's support for switching between the portrait and the screen:
 <activity android:name=   android:screenorientation=  "  ; 
   android:screenorientation   property values are as follows: 

" Unspecified "
-default value. The display direction is selected by the system. Different devices may vary.

Landscape
-Horizontal

"Portrait"
-Portrait

" user "
-user's current preferred orientation

"behind"
-the same direction as the activity under the active stack

sensor
-determines the orientation based on the physical direction sensor. Depending on the direction the user is holding, when the user rotates the device, it changes.

" nosensor "
-the direction is not determined by the physical direction sensor. The sensor is ignored, so when the user rotates the device, the display does not change. In addition to this distinction, the system chooses to use the same policy orientation for the "unspecified" setting. The system selects the same display direction according to the "Unspecified" ("unspecified") setting.


can also be used setrequestedorientation () in the background to make a portrait and the screen toggle



Reference:

/http www.cnblogs.com/bluestorm/archive/2012/05/07/2486954.html

http://blog.csdn.net/nmgchfzhzhg/article/ details/8077133

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.