Determines whether the current screen is full screen + whether it is a vertical screen

Source: Internet
Author: User

We all know that setting up full screen for activity has a way of setting it in the theme and having it set in the code. So how do you get the current full screen? There are many articles on the Internet using the same method, this method I have been tested basically in the waste level, my is 4.4.4 can't use online spread method. I'll give you an implementation of my own.

    /**     * @paramactivity *@returndetermine if the current phone is full screen*/     Public Static BooleanIsFullScreen (activity activity) {intFlag =Activity.getwindow (). GetAttributes (). Flags; if(Flag &WindowManager.LayoutParams.FLAG_FULLSCREEN)==WindowManager.LayoutParams.FLAG_FULLSCREEN) {            return true; }Else {            return false; }    }

2 ways to set up a full screen

GetWindow (). Addflags (WindowManager.LayoutParams.FLAG_FULLSCREEN); GetWindow (). Addflags ( WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);
GetWindow (). SetFlags (Windowmanager.layoutparams. Flag_fullscreen,              windowmanager.layoutparams. Flag_fullscreen); // Full Screen

To cancel a full-screen method

Determine if the current is a vertical screen

/*** Determine if the current screen is horizontal screen *@paramactivity *@return     */     Public Static BooleanIsverticalscreen (activity activity) {intFlag =activity.getresources (). GetConfiguration (). Orientation; if(flag = = 0) {            return false; }Else {            return true; }    }

Attached:Android system comes with style

Android:theme= "@android: Style/theme.dialog" displays an activity as a dialog box mode
Android:theme= "@android: Style/theme.notitlebar" does not display the application title bar
Android:theme= "@android: Style/theme.notitlebar.fullscreen" does not display the application title bar and full screen
Android:theme= "Theme.light" background is white
Android:theme= "Theme.Light.NoTitleBar" white background with no title bar
Android:theme= "Theme.Light.NoTitleBar.Fullscreen" white background, no title bar, fullscreen
Android:theme= "Theme.black" background black
Android:theme= "Theme.Black.NoTitleBar" black background with no title bar
Android:theme= "Theme.Black.NoTitleBar.Fullscreen" black background, no title bar, fullscreen
Android:theme= "Theme.wallpaper" with system desktop for application background
Android:theme= "Theme.Wallpaper.NoTitleBar" uses the system desktop as the application background with no title bar
Android:theme= "Theme.Wallpaper.NoTitleBar.Fullscreen" with system desktop for application background, no title bar, fullscreen
Android:theme= "translucent" Transparent background
Android:theme= "Theme.Translucent.NoTitleBar" Transparent background with no title
Android:theme= "Theme.Translucent.NoTitleBar.Fullscreen" Transparent background with no caption, fullscreen
Android:theme= "Theme.panel" Panel style display
Android:theme= "Theme.Light.Panel" tablet style display

Reference from: http://blog.csdn.net/shakespeare001/article/details/7779011

Determines whether the current screen is full screen + whether it is a vertical screen

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.