日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 运维知识 > Android >内容正文

Android

Android 禁止下拉菜单栏

發(fā)布時間:2024/3/26 Android 52 豆豆
生活随笔 收集整理的這篇文章主要介紹了 Android 禁止下拉菜单栏 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

Android 禁止下拉菜單欄

如下圖,有時候我們需要禁止用戶下拉出菜單欄。

在解決這個問題之前,我們需要知道,下拉菜單欄總共有兩種,一種是鎖屏下的下拉菜單,一種是非鎖屏下的下拉菜單。因此需要兩種不同的方法,才能將下來菜單欄屏蔽干凈。

1.屏蔽非鎖屏下的下拉菜單欄

這種Android 系統(tǒng)其實是提供了方法的,只不過是隱藏的,只給系統(tǒng)應用,也就是用mk 編譯的apk使用。如果第三方應用想要使用,或者Android stuido 編譯方式的想要使用。則可以使用反射。

/*** Allows an app to control the status bar.*/ @SystemService(Context.STATUS_BAR_SERVICE) public class StatusBarManager {/** @hide */public static final int DISABLE_EXPAND = View.STATUS_BAR_DISABLE_EXPAND;/** @hide */public static final int DISABLE_NOTIFICATION_ICONS = View.STATUS_BAR_DISABLE_NOTIFICATION_ICONS;/** @hide */public static final int DISABLE_NOTIFICATION_ALERTS= View.STATUS_BAR_DISABLE_NOTIFICATION_ALERTS;/** @hide */@Deprecated@UnsupportedAppUsagepublic static final int DISABLE_NOTIFICATION_TICKER= View.STATUS_BAR_DISABLE_NOTIFICATION_TICKER;/** @hide */public static final int DISABLE_SYSTEM_INFO = View.STATUS_BAR_DISABLE_SYSTEM_INFO;/** @hide */public static final int DISABLE_HOME = View.STATUS_BAR_DISABLE_HOME;/** @hide */public static final int DISABLE_RECENT = View.STATUS_BAR_DISABLE_RECENT;/** @hide */public static final int DISABLE_BACK = View.STATUS_BAR_DISABLE_BACK;/** @hide */public static final int DISABLE_CLOCK = View.STATUS_BAR_DISABLE_CLOCK;/** @hide */public static final int DISABLE_SEARCH = View.STATUS_BAR_DISABLE_SEARCH;/** @hide */@Deprecatedpublic static final int DISABLE_NAVIGATION =View.STATUS_BAR_DISABLE_HOME | View.STATUS_BAR_DISABLE_RECENT;/** @hide */public static final int DISABLE_NONE = 0x00000000;/** @hide */public static final int DISABLE_MASK = DISABLE_EXPAND | DISABLE_NOTIFICATION_ICONS| DISABLE_NOTIFICATION_ALERTS | DISABLE_NOTIFICATION_TICKER| DISABLE_SYSTEM_INFO | DISABLE_RECENT | DISABLE_HOME | DISABLE_BACK | DISABLE_CLOCK| DISABLE_SEARCH; /*** Disable some features in the status bar. Pass the bitwise-or of the DISABLE_* flags.* To re-enable everything, pass {@link #DISABLE_NONE}.** @hide*/@UnsupportedAppUsagepublic void disable(int what) {try {final int userId = Binder.getCallingUserHandle().getIdentifier();final IStatusBarService svc = getService();if (svc != null) {svc.disableForUser(what, mToken, mContext.getPackageName(), userId);}} catch (RemoteException ex) {throw ex.rethrowFromSystemServer();}}

2. 屏蔽鎖屏下的下拉菜單欄

這種沒有接口,只能在systemui 里面修改源碼,來屏蔽掉。

總結

以上是生活随笔為你收集整理的Android 禁止下拉菜单栏的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。