Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/188.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/codeigniter/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 系统用户界面模式更改后如何更改屏幕覆盖(全屏、隐藏导航)?_Android_Overlay_Fullscreen - Fatal编程技术网

Android 系统用户界面模式更改后如何更改屏幕覆盖(全屏、隐藏导航)?

Android 系统用户界面模式更改后如何更改屏幕覆盖(全屏、隐藏导航)?,android,overlay,fullscreen,Android,Overlay,Fullscreen,我创建覆盖: mWindowManager = (WindowManager) mContext.getSystemService(Context.WINDOW_SERVICE); LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE); /*The parent view (actually the root view) the

我创建覆盖:

mWindowManager = (WindowManager) mContext.getSystemService(Context.WINDOW_SERVICE);
    LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);

    /*The parent view (actually the root view) the will be added in front of all the windows on the screen*/
    mOverlayView = (RelativeLayout) inflater.inflate(R.layout.overlay_control, null);

        mWindowManager.getDefaultDisplay().getSize(size);
        mWindowSize = new Size(size.x, size.y);

    WindowManager.LayoutParams params = new WindowManager.LayoutParams(
            WindowManager.LayoutParams.WRAP_CONTENT,
            WindowManager.LayoutParams.WRAP_CONTENT,
            WindowManager.LayoutParams.TYPE_PHONE,
            WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE |
                    WindowManager.LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH |
                    WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS |
            WindowManager.LayoutParams.FLAG_FULLSCREEN,
            PixelFormat.TRANSLUCENT);
    params.gravity = Gravity.TOP | Gravity.LEFT;
    mWindowManager.addView(mOverlayView, params);

如果系统UI可见性发生变化,我需要移动覆盖。有可能在视图中检测它(),但在覆盖中不起作用。因此,我只需要回调来检测设备的模式是否改变。

我找到了方法:

在安卓系统中,有
onSystemMiviabilityChangeListener
,但如果没有具有
match\u parent
宽度或高度值的视图,它就不起作用

因此,我创建了这样的覆盖,使其高度为1px,宽度为
match\u parent
width,并向其添加
onsystemivilitychangesetener