I am trying to create a simple android app to display a black bar across the top and bottom of the screen, as I do not like the new trend of round screen corners that all the phones have now, and there doesn't seem to currently be any solutions to this problem that do not require a rooted phone. I am trying to hide the rounded corners to create the appearance of a more traditional and more aesthetically pleasing rectangular display, using a system overlay to draw over all other apps. This is the code I am currently using for the overlay, based on this https://gist.github.com/bjoernQ/6975256
wm = (WindowManager) getSystemService(Context.WINDOW_SERVICE);
overlayedButton1 = new Button(this);
overlayedButton1.setBackgroundColor(-16777216);
overlayedButton2 = new Button(this);
overlayedButton2.setBackgroundColor(-16777216);
WindowManager.LayoutParams params1 = new WindowManager.LayoutParams(WindowManager.LayoutParams.WRAP_CONTENT, WindowManager.LayoutParams.WRAP_CONTENT, WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY, WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE | WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL, PixelFormat.TRANSLUCENT);
params1.gravity = Gravity.LEFT | Gravity.TOP;
params1.x = 0;
params1.y = 0;
params1.width = 1080;
params1.height = 100;
wm.addView(overlayedButton1, params1);
WindowManager.LayoutParams params2 = new WindowManager.LayoutParams(WindowManager.LayoutParams.WRAP_CONTENT, WindowManager.LayoutParams.WRAP_CONTENT, WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY, WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE | WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL, PixelFormat.TRANSLUCENT);
params2.gravity = Gravity.LEFT | Gravity.BOTTOM;
params2.x = 0;
params2.y = 0;
params2.width = 1080;
params2.height = 100;
wm.addView(overlayedButton2, params2);
The result is a black bar below the status bar and above the navigation bar as shown in the image
https://i.stack.imgur.com/CbUYD.jpg
I am new to Android development so not sure how to position the bars to the absolute top and bottom of the screen?
Another problem is when opening apps that run in landscape mode, the black bars of my overlay app also get rotated, so they are on the sides of the screen.
I have added android:screenOrientation="portrait" to the manifest file but this makes no difference.
How can I make the black bars stay at the top and bottom edges of the screen, regardless of app rotation?