The position relationship between the status bar and the activity is realized through setsystemuivisibility

Source: Internet
Author: User

In the past, the removal of the status bar and the title bar is always implemented in the form of dynamic code:

GetWindow (). SetFlags (Windowmanager.layoutparams. Flag_fullscreen, Windowmanager.layoutparams. Flag_fullscreen);  
Requestwindowfeature (Window.feature_no_title);   

However, in the project development, in the collection of data suddenly found a very useful API, this API is setsystemuivisibility ();

It can basically be defined as the position relationship between the status bar and the activity. The way it dynamically hides and displays the status bar is as follows:


setsystemuivisibility (int visibility) The input argument types are as follows:

1.view.system_ui_flag_visible: The status bar and activity coexist, the activity is not displayed in full screen. That is, the normal display screen is applied.

2.View.SYSTEM_UI_FLAG_FULLSCREEN:Activity full screen, and the status bar is overwritten

3. View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN:Activity full screen display, but the status bar will not be overwritten, but the normal display, but the activity top layout will be covered

4.View.INVISIBLE:Activity Full-screen display, hide status bar

The most basic usage of these four, in fact, there are some types of arguments did not describe, reckoned the actual development needs are not necessarily used, there is no need to understand, to meet the need, and then check the document usage on the line.

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

The position relationship between the status bar and the activity is realized through setsystemuivisibility

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.