I have successfully implemented a floating window to be displayed from a Service on top of all activities using Window Manager services. Also, I am handling the touch events to be able to drag it. As desired, the touch and click events on the floating window works well. Also, any clicks outside the window are correctly handled by the activities beneath the window.
However, there are these two issues that are troubling me since long.
-
- The back and menu buttons do not react to the touch events while the floating window is around
-
- If the activity beneath the floating window displays a list view, the list elements do not react to click events. What is even more weird is that it does correctly handle any click event on the sub-components within the list element e.g. a check-box in each row in the list view. But the list element click handler would not get called no matter what despite showing the click animation.
Here is the relevant code. Any help is deeply appreciated.
final WindowManager.LayoutParams parameters = new WindowManager.LayoutParams(
FrameLayout.LayoutParams.WRAP_CONTENT,FrameLayout.LayoutParams.WRAP_CONTENT, WindowManager.LayoutParams.TYPE_PHONE,
WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL|WindowManager.LayoutParams.FLAG_DIM_BEHIND,
PixelFormat.TRANSLUCENT);
wm = (WindowManager) getSystemService(WINDOW_SERVICE);
wm.addView(<myView>, parameters);