Dynamic Setting of full screen, canceling full screen, and switching of full screen to keep content unchanged

Source: Internet
Author: User

Http://blog.csdn.net/lovehong0306


There are two methods for setting and canceling full screen, which are called two forms instead of two, because the two methods are different in writing and are essentially the same.


Form 1:

// Set full screen

Getwindow (). addflags (windowmanager. layoutparams. flag_fullscreen );

// Cancel full screen

Getwindow (). clearflags (windowmanager. layoutparams. flag_fullscreen );


Form 2:

// Set full screen

Windowmanager. layoutparams ATTR = getwindow (). getattributes ();
ATTR. Flags | = windowmanager. layoutparams. flag_fullscreen;
Getwindow (). setattributes (ATTR );

// Cancel full screen

Windowmanager. layoutparams ATTR = getwindow (). getattributes ();
ATTR. Flags & = (~ Windowmanager. layoutparams. flag_fullscreen );
Getwindow (). setattributes (ATTR );



Change the full screen status to non-full screen to keep the content position unchanged:
Getwindow (). setflags (
Windowmanager. layoutparams. flag_layout_in_screen,
Windowmanager. layoutparams. flag_layout_inset_decor );


Here is a problem:

When this flag is set, the full screen is canceled and some content is blocked by the status bar (ignore the height of the status bar and use the origin in the upper-right corner of the screen to calculate the layout)

Add the code getwindow (). clearflags (windowmanager. layoutparams. flag_layout_in_screen); To solve this problem, but the status bar does not disappear when the full screen is set again.

At present, there are no good solutions to this problem,

If you have any ideas to solve this problem, please feel free to provide it to me.


Http://blog.csdn.net/lovehong0306


Dynamic Setting of full screen, canceling full screen, and switching of full screen to keep content unchanged

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.