2013-04-23 60 views
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); 
+0

这里,给它看看。 [Answer] [1] http://stackoverflow.com/questions/4222713/hide-notification-bar – dwbrito 2013-04-23 10:38:52

回答

1

只需添加到您的清单:

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