Skip to content Skip to sidebar Skip to footer

Android : Place Non-clickable View Above All Application Windows But Below Notification Bar

Sorry for the long title. I would basically like to add a SurfaceView as a window that appears above all windows but not above the notification bar (even when dragged down). The co

Solution 1:

Solved!

WindowManager.LayoutParams params = new WindowManager.LayoutParams(WindowManager.LayoutParams.WRAP_CONTENT,
                WindowManager.LayoutParams.WRAP_CONTENT,
                WindowManager.LayoutParams.TYPE_SYSTEM_ALERT,
                WindowManager.LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH |
                        WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN |
                        WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL |
                        WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE |
                        WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE,
                PixelFormat.TRANSLUCENT);

TYPE_SYSTEM_ALERT ensures that the system notification bar remains above my view. FLAG_NOT_TOUCH_MODAL allows touch events to be sent to the windows behind the view; and FLAG_NOT_TOUCHABLE and FLAG_NOT_FOCUSABLE ensure the view doesn't receive touch or key events.


Post a Comment for "Android : Place Non-clickable View Above All Application Windows But Below Notification Bar"