1

我想使用en禁用通知栏,但是当我尝试将此代码放在主 Activity 的 OnCreat 方法中时,我遇到了一些问题。我不知道该放 什么,我想放<height of the status bar>什么,我有一些问题和使用问题 ;未知,我无法使用paramshandleParamscontext.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);
4

1 回答 1

1

只需添加到您的清单:

android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
于 2013-04-23T10:47:15.367 回答