1

I'm making an overlay by adding views directly to the window using WindowManager. However, I can't seem to find flags necessary to do what chathead does, which is to have the overlay on top of the soft keyboard. My overlay always gets covered by keyboard when it pops up.

this is the params I am using for my views that are added to the window

private WindowManager.LayoutParams touchableParams = new WindowManager.LayoutParams(
        ViewGroup.LayoutParams.MATCH_PARENT,
        ViewGroup.LayoutParams.MATCH_PARENT,
        WindowManager.LayoutParams.TYPE_PHONE,
        WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED
                | WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN,
        PixelFormat.TRANSLUCENT);
Jason Hu
  • 1,187
  • 2
  • 13
  • 29
  • Have you seen this? http://stackoverflow.com/questions/15975988/what-apis-in-android-is-facebook-using-to-create-chat-heads – Daniel Nugent Jan 10 '17 at 00:22
  • yea, i tried `TYPE_SYSTEM_ALERT` but it does not go over the soft keyboard. AFAIK, the only difference between `TYPE_PHONE` and `TYPE_SYSTEM_ALERT` is that the former is for all users and the latter is for the owning user – Jason Hu Jan 10 '17 at 00:23

1 Answers1

0

Don't know your other requirements. I have been using this setup under Android 7.1.12 on a Google Pixel to make the overlay show on top of the soft keyboard. Hopefully this is what your are looking for.

mWindowsParams = new WindowManager.LayoutParams(
            width,
            height,
            WindowManager.LayoutParams.TYPE_PHONE,
            WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED | WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE,
            PixelFormat.TRANSLUCENT);