A discussion about getrotation in Android.

Source: Internet
Author: User

============ Problem Description ============


As we all know, normally, use int rotation = Mactivity.getwindowmanager (). Getdefaultdisplay (). Getrotation () to get the orientation of the screen rotation.

But the return value of this rotation in the end has and meaning, in the online search a lot of posts, mostly is very vague description of the knowledge is irresponsible reprint.

We look at Getrotation's API description, which includes "Returns the rotation of the screen from its" natural "orientation."

Here Google itself to "natural" quotes, meaning that normal is human-defined, is variable.

For a pad that is a horizontal screen by default, how do I define a horizontal screen by default? After my experiments, I found that the horizontal screen or vertical screen is based on the direction of the camera.
The same is true for vertical screens.

Such as:


============ Solution 1============


You can write your research in a blog post.

A discussion about getrotation in Android.

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.