Fullscreen view with gravity.BOTTOM is unwantingly clipped when an overscan value is set

72 Views Asked by At

My Android (8.0+) app is implementing a narrow overlay along the bottom of the screen, but when a user sets an overscan value, it disappears. How can I make my view respect what is actually visible so Gravity.BOTTOM will not be clipped? I have tried countless combinations of flags, but nothing seems to ackknowledge the overscan value.

Point screen_size = new Point();
WindowManager.LayoutParams mParams;

WindowManager mWindowManager = getSystemService(WINDOW_SERVICE);
        mWindowManager.getDefaultDisplay().getRealSize(screen_size);

layout = new LinearLayout(getApplicationContext());
layout.setOnTouchListener(this);

// color for debug.
layout.setBackgroundColor(0x55ff0000);

mParams = new WindowManager.LayoutParams(
        screen_size.x,
        40,
        0,
        0,    
        WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY,
        WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN | WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE,
        PixelFormat.TRANSLUCENT);
mParams.gravity = Gravity.BOTTOM;
mWindowManager.addView(layout, mParams);
0

There are 0 best solutions below