Full screen processing in android6.0 (disable notification bar slide)

Source: Internet
Author: User

In the android6.0 project, because of the need to do full-screen processing, so in the full screen when the bar to suppress the drop of the code, hope can help to also have so confused people.

1. Add://Set full screen in OnCreate

Requestwindowfeature (Window.feature_no_title);

GetWindow (). SetFlags (WindowManager.LayoutParams.FLAG_FULLSCREEN,

WindowManager.LayoutParams.FLAG_FULLSCREEN);

2. In the Onresume () function, add://Enter activity, set the prohibit notification bar not slippery

Settings.System.putInt (This.getcontentresolver (),

Settings.System.FULL_SCREEN_EXPAND_STATUSBAR, 0);

3. In the OnPause () function add://When leaving activity, resume notification bar slipped

Settings.System.putInt (This.getcontentresolver (),

Settings.System.FULL_SCREEN_EXPAND_STATUSBAR, 1);

4. In frameworks/base/services/core/java/com/android/server/policy/ Phonewindowmanager.javar the UPDATESYSTEMUIVISIBILITYLW () function adds://This code I added in tmpvisibility = UPDATELIGHTSTATUSBARLW ( tmpvisibility); After that, it is possible that other people's project code has been changed, in the need for this code, as appropriate, to add to the appropriate location.

final int visibility;

if (Settings.System.getInt (Mcontext.getcontentresolver (),

Settings.System.FULL_SCREEN_EXPAND_STATUSBAR, 1) = = 0) {

visibility = tmpvisibility;

}else{

visibility = UPDATESYSTEMBARSLW (win, mlastsystemuiflags,tmpvisibility);

}

5. Add://define Full_screen_expand_statusbar in Frameworks/base/core/java/android/provider/settings.java

public static final String Full_screen_expand_statusbar = "Full_screen_expand_statusbar";

6. Add in Frameworks/base/packages/settingsprovider/src/com/android/providers/settings/settingsprovider.java:/ The meaning is basically the same as the above OnPause ().

Systemsettings.insertsettinglocked (Settings.System.FULL_SCREEN_EXPAND_STATUSBAR, "1", settingsstate.system_ Package_name);

Note: In order to ensure the addition of full_screen_expand_statusbar will not affect the rest of the system, the above 6 code please complete add, otherwise it may cause unknown error!

This article is from the "Smart Life Change" blog, so be sure to keep this source http://restlessheart.blog.51cto.com/3831429/1784409

Full screen processing in android6.0 (disable notification bar slide)

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.