Android dynamic full screen and exit full screen

Source: Internet
Author: User

Make androidProgramAs we all know, the full screen method is static. It is stated at the beginning of the program running. However, if you want to execute an operation while running the program to make it full screen, you still need to exit full screen. How can this problem be solved?

As follows:

    1. Windowmanager. layoutparams attrs = getwindow (). getattributes ();
    2. Attrs. Flags | = windowmanager. layoutparams. flag_fullscreen;
    3. Getwindow (). setattributes (attrs );
    4. Getwindow (). addflags (windowmanager. layoutparams. flag_layout_no_limits );

Modify the layoutparams parameter of the window and add the flag_layout_no_limits flag to it. Window is automatically displayed in full screen mode.

To exit full screen, you only need to clear the flag_fullscreen parameter that you just added, and then remove the flag_layout_no_limits flag.

As follows:

    1. windowmanager. layoutparams attrs = getwindow (). getattributes ();
    2. attrs. Flags & = (~ Windowmanager. layoutparams. flag_fullscreen);
    3. getwindow (). setattributes (attrs);
    4. getwindow (). clearflags (windowmanager. layoutparams. flag_layout_no_limits);
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.