Cocos2d-x3.1.1 in android to set horizontal and vertical screen, cocos2dandroid

Source: Internet
Author: User

Cocos2d-x3.1.1 in android to set horizontal and vertical screen, cocos2dandroid

In the AndroidManifest. xml file of proj. android in the project, it is easy to modify the information !!!

ScreenOrientation = "landscape" is a landscape screen,

ScreenOrientation = "portrait" is a portrait Screen


How does android determine whether the current screen is landscape screen or landscape screen?

Use this method to getActivity (). getResources (). getConfiguration (). orientation
1 vertical screen 0 horizontal screen

In android compilation, how does one configure the default display of landscape and landscape screens?

5. Modify the portrait Screen Display
You must modify the source code and re-compile the code to implement this function.
Frameworks/base/core/res/values/config. xml
Before modification: <integer name = "config_lidOpenRotation"> 90 </integer>
After modification: <integer name = "config_lidOpenRotation"> 0 </integer>

In addition:
Sets the direction of the Activity main window. The direction in the array is set to the screenOrientation attribute in the R. attr class,
* The value of screenOrientation must be a constant value.
* ActivityInfo. SCREEN_ORIENTATION_UNSPECIFIED:
* If no direction is specified, the system determines the best direction of the Activity.
* ActivityInfo. SCREEN_ORIENTATION_LANDSCAPE:
* You want the Activity to be displayed on the horizontal screen, that is, the horizontal width must be greater than the vertical height, and the influence of the direction sensor is ignored.
* ActivityInfo. SCREEN_ORIENTATION_PORTRAIT:
* You want the Activity to be displayed on the portrait screen, that is, the portrait height must be greater than the horizontal width, and the impact of the orientation sensor is ignored.
* ActivityInfo. SCREEN_ORIENTATION_USER:
* Use the current preferred direction of your device.
* ActivityInfo. SCREEN_ORIENTATION_BEHIND:
* Always keep the same direction as the screen, no matter whether the Activity is in the foreground or background.
* ActivityInfo. SCREEN_ORIENTATION_SENSOR:
* The Activity direction is determined by the physical direction sensor and displayed in the direction of the user's rotating device.
* ActivityInfo. SCREEN_ORIENTATION_NOSENSOR:
* Always ignore the orientation sensor's judgment. When the user rotates the device, the display does not rotate.
* ActivityInfo. SCREEN_ORIENTATION_SENSOR_LANDSCAPE:
* You want the Activity to be displayed on the horizontal screen, but you can change it according to the direction indicated by the Direction sensor.
* ActivityInfo. SCREEN_ORIENTATION_SENSOR_PORTRAIT:
* You want the Activity to be displayed on the portrait screen, but you can change it according to the direction indicated by the Direction sensor.
* ActivityInfo. SCREEN_ORIENTATION_REVERSE_LANDSCAPE:
* You want the Activity to be displayed on the horizontal screen, but it is opposite to the normal horizontal screen.
* ActivityInfo. SCREEN_ORIENTATION_REVERSE_PORTRAIT:
* You want the Activity to be displayed on the portrait screen, but it is opposite to the normal portrait screen.
* ActivityInfo. SCREEN_ORIENTATION_FULL_SENSOR:... the remaining full text>

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.