1

我想隐藏我的平板电脑的状态栏,在状态栏上添加一个透明胶带来锁定触摸事件,但我的问题是状态栏显示在顶部而不是在状态栏上。如何改变它的位置。

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);
4

0 回答 0