我想隐藏平板电脑的状态栏,在状态栏中添加透明磁带以锁定触摸事件,但我的问题是条形图显示在顶部而不是在状态栏上。如何改变自己的立场。
View disableStatusBar = new View(this);
disableStatusBar.setBackgroundColor(Color.BLUE);
WindowManager.LayoutParams handleParams = new WindowManager.LayoutParams(
WindowManager.LayoutParams.FILL_PARENT, 50,
// This allows the view to be displayed over the status bar
WindowManager.LayoutParams.TYPE_SYSTEM_ALERT,//or other type_system make same
// 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.TYPE_STATUS_BAR_PANEL,
PixelFormat.TRANSLUCENT);
handleParams.gravity = Gravity.CLIP_HORIZONTAL | Gravity.TOP;
getWindow().addContentView(disableStatusBar, handleParams);