【问题标题】:How to disable Notification Bar?如何禁用通知栏?
【发布时间】:2013-04-23 18:47:15
【问题描述】:

我想使用en 禁用通知栏,但是当我尝试将此代码放在主 Activity 的 OnCreat 方法中时,我遇到了一些问题。我不知道在<height of the status bar> 中输入什么,params 是什么我试图输入handleParams,我遇到了一些问题和使用问题 context.getWindow().addView(view, params);未知,我无法使用context.getWindow()

 View disableStatusBar = new View(context);
    WindowManager.LayoutParams handleParams = new WindowManager.LayoutParams(
        WindowManager.LayoutParams.FILL_PARENT,
        <height of the status bar>,
        // This allows the view to be displayed over the status bar
        WindowManager.LayoutParams.TYPE_SYSTEM_ALERT,
        // this is to keep button presses going to the background window
        WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE |
        // this is to enable the notification to recieve touch events
        WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL |
        // Draws over status bar
        WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN,
        PixelFormat.TRANSLUCENT);
    params.gravity = Gravity.TOP;
    context.getWindow().addView(view, params);

【问题讨论】:

标签: android android-notification-bar


【解决方案1】:

只需添加到您的清单中:

android:theme="@android:style/Theme.NoTitleBar.Fullscreen"

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-04-04
    • 1970-01-01
    相关资源
    最近更新 更多