This article describes the method of Android programming to prohibit StatusBar pull-down. Share it for your reference, as follows:
There are many hidden Services in Android, and StatusBarManager is one of them, you can see:
/** * Use with {@link #getSystemService} to retrieve a {@link * } for interacting with the status bar. * * @see #getSystemService * @see * @hide */ public static final String STATUS_BAR_SERVICE = "statusbar";
This indicates that the service is not provided to the public. If you want to call it, you need to compile it on the source tree before you can call the interface marked @hide. You can also add the source code compiled packages to the project.
StatusBarManager provides some useful interfaces, such as the disable() method, which is exactly what we need, and some system-level applications also call this method that prohibits StatusBar from pulling down, such as phone and lock screen modules. To call this method, you also need the following permissions:
<uses-permission android:name=".STATUS_BAR" /> <uses-permission android:name=".EXPAND_STATUS_BAR"/>
Get StatusBarManager instance
mStatusBarManager = (StatusBarManager) (Context.STATUS_BAR_SERVICE);
No pull-down
(StatusBarManager.DISABLE_EXPAND);
Release the ban
(StatusBarManager.DISABLE_NONE);
Disable Android's StatusBar pull-down
For more information about Android related content, please check out the topic of this site:Android development introduction and advanced tutorial》、《Android multimedia operation skills summary (audio, video, recording, etc.)》、《Summary of the usage of basic Android components》、《Android View View Tips Summary》、《Android layout layout tips summary"and"Android control usage summary》
I hope this article will be helpful to everyone's Android programming design.