2

Good afternoon. I have a service in which the object is created and WindowManager View - is assigned parameter background (mView.setBackgroundColor(color). The fact is that now I have View drawn only over the main desktop screen and status bar, and navigation bar is not affected. How do I do to View draws and on top of the navigation bar (buttons) in the Android? At the moment:

@Override
public void onCreate() {
    super.onCreate();
    mView = new LinearLayout(this);
    WindowManager.LayoutParams params = new WindowManager.LayoutParams(
            WindowManager.LayoutParams.MATCH_PARENT,
            WindowManager.LayoutParams.MATCH_PARENT,
            WindowManager.LayoutParams.TYPE_SYSTEM_OVERLAY,
            0 | WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE| WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN,
            PixelFormat.TRANSLUCENT);


    WindowManager wm = (WindowManager) getSystemService(WINDOW_SERVICE);
    wm.addView(mView, params);
}

Result: enter image description here

That is all I have to paint in red, relatively speaking, including a navigation bar. Thank you.

RS90
  • 23
  • 7

1 Answers1

0
int value_below_screen=100;
params.y=-value_below_screen;

this will offset the screen below by "value_below_screen"

Sheraz Arshad
  • 211
  • 3
  • 10