Question

In my application, I need to draw a bitmap on top of all the apps running. I created a view which is invisible and overlays on top of all the apps. with this overlay view I can draw bitmaps at the given position , But I am unable to draw the bitmap on top of the Navigation Bar.I used the following layout parameters.

    WindowManager.LayoutParams.TYPE_SYSTEM_OVERLAY,
    WindowManager.LayoutParams.FLAG_FULLSCREEN
    |WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE
    |WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE
    |WindowManager.LayoutParams.FLAG_LAYOUT_INSET_DECOR 
    |WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS,

I need help in solving this issue. Thanks in advance

Was it helpful?

Solution

I have solved the issue myself , to draw on top of navigation bar at the bottom of the android , I have to give an offset in the Y position while defining the windowManager.Layout params as below.

w = new android.view.WindowManager.LayoutParams(-1, -1,0,-navigationBarHeight(),    WindowManager.LayoutParams.TYPE_SYSTEM_OVERLAY,
    WindowManager.LayoutParams.FLAG_FULLSCREEN
    |WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE
    |WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE
    |WindowManager.LayoutParams.FLAG_LAYOUT_INSET_DECOR 
    |WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS, Pixel.Translucent);
    f.addView(v, w);

note: This only works when the navigation bar is translucent

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top