简体   繁体   English

禁用Android通知栏

[英]Disable the android notification bar

i just want to know how can i disable the notification bar in my mobile without making my activity fullscreen? 我只想知道如何在不使我的活动全屏显示的情况下禁用手机中的通知栏?

Im doing kind of a lockscreen and i dont want the user can drag down the notification bar. 我正在做一个锁屏,我不希望用户可以拖动通知栏。

add this code in to your AndroidManifest.xml 将此代码添加到您的AndroidManifest.xml中

android:theme="@android:style/Theme.NoTitleBar" android:theme =“ @ android:style / Theme.NoTitleBar”

public static void CancelNotification(Context ctx, int notifyId) { String ns = Context.NOTIFICATION_SERVICE; public static void CancelNotification(Context ctx,int notifyId){字符串ns = Context.NOTIFICATION_SERVICE; NotificationManager nMgr = (NotificationManager) ctx.getSystemService(ns); NotificationManager nMgr =(NotificationManager)ctx.getSystemService(ns); nMgr.cancel(notifyId); nMgr.cancel(notifyId); } }

This sounds like what you need. 这听起来像您所需要的。 It invovles creating a transparent window overlapping the status bar and thereby intercepting all touch events to it. 它参与创建一个透明窗口,该窗口与状态栏重叠,从而拦截到其的所有触摸事件。

You'll still keep the status bar, the user just won't be able to activate it. 您仍将保留状态栏,用户将无法激活它。

https://stackoverflow.com/a/7630993/455886 https://stackoverflow.com/a/7630993/455886

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM