Android Official Development Document Training Series course in Chinese: dimming system for managing system UI

Source: Internet
Author: User

Original address: http://android.xsoftlab.net/training/system-ui/index.html

Introduction

System Bars is a display area on the screen that is designed to display notifications, device communication status, and device orientation. The typical system bars is displayed on the screen with the app. The app displays specific content, such as a movie or photo, that temporarily dims the system Bars icon to reduce unwanted interference, or temporarily hides the system Bars to enter an immersive state.

If you're familiar with Android design guide, it's important to know that the app is designed to fit the standard Android UI. Before modifying the system bars, you should carefully consider what the user needs and expect, as this will give the user a standard way to manipulate the device and view the status of the device (PS: Plainly it can be quickly started).

This lesson will discuss how to darken or hide the system bars in different versions of Android to create an immersive user experience and retain the quick way to access system bars.

Darken the system bars

This lesson will describe how to darken the system bars for Android 4.0 or more systems. Android does not provide a way to darken system bars for earlier versions.

When you use this method, the content area does not resize, but the system bars is visually retracted. Both of these bars are fully visible, whether the user clicked the status bar area or the navigation bar area. The advantage of this approach is that bar is still in, but their details are blurred, so using bar makes it easy to create an immersive experience without any cost loss.

Darken the state navigation bar

You can use the SYSTEM_UI_FLAG_LOW_PROFILE flag to darken the status bar and the notification bar in Android version 4.0 and above:

// This example uses decor view, but you can use any visible view.View decorView = getActivity().getWindow().getDecorView();int uiOptions = View.SYSTEM_UI_FLAG_LOW_PROFILE;decorView.setSystemUiVisibility(uiOptions);

This flag is cleared when the user touches the status navigation bar, which lightens the status navigation bar. Once this flag is cleared, you will need to reset this flag if you want to darken the navigation bar again.

Shows the effect of the navigation bar darkening (note that this is just hiding the status bar, not darkening it). Note that the navigation bar (to the right of the image) is a light white dot here:

The same image is displayed, but the system bar is completely displayed:

Lighten the status navigation bar

If you want to clear this flag, you can do this:

View decorView = getActivity().getWindow().getDecorView();// Calling setSystemUiVisibility() with a value of 0 clears// all flags.decorView.setSystemUiVisibility(0);

Android Official Development Document Training Series Chinese version: dimming system bar for managing system UI

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.