Draw bitmaps on top of the Navigation bar in Android

前端 未结 1 1745
感情败类
感情败类 2021-01-06 03:50

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

相关标签:
1条回答
  • 2021-01-06 04:06

    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

    0 讨论(0)
提交回复
热议问题