1
我想禁用通知欄使用en,但是當我試圖把這個代碼放在我的OnCreat方法的主要Activity中,我有一些問題。我不知道該寫什麼<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);
這裏,給它看看。 [Answer] [1] http://stackoverflow.com/questions/4222713/hide-notification-bar – dwbrito 2013-04-23 10:38:52