全屏绘制其他应用程序

时间:2019-04-09 14:23:06

标签: android

我想在其他应用程序之上绘制全屏视图。 我无法绘制状态栏。

WindowManager.LayoutParams layoutParams = new WindowManager.LayoutParams(WindowManager.LayoutParams.FLAG_FULLSCREEN,
    WindowManager.LayoutParams.FLAG_FULLSCREEN,
    WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY,
        WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE |
        WindowManager.LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH |
        WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED|
        WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN,
    PixelFormat.TRANSLUCENT);

layoutParams.gravity = Gravity.TOP | Gravity.CENTER_HORIZONTAL;
overlayView = LayoutInflater.from(this).inflate(R.layout.overlay, null);
windowManager.addView(overlayView, layoutParams);

0 个答案:

没有答案