Rohit
Rohit

Reputation: 810

how to avoid window view to come over Keyboard?

I have window view in bottom and when i click on any edittext, keyboard opens but below windows view (Windowview comes over keyboard). Tried using adjustPan, adjustResize. Tried using show hide the view as per keyboard visibility but it give Security Exception.

 mTabParams = new WindowManager.LayoutParams(
                ViewGroup.LayoutParams.MATCH_PARENT,
                ViewGroup.LayoutParams.WRAP_CONTENT, WindowManager.LayoutParams.TYPE_SYSTEM_ALERT |
                WindowManager.LayoutParams.TYPE_SYSTEM_OVERLAY,
                WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL |
                        WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE,
                PixelFormat.TRANSPARENT);

        mTabParams.format = PixelFormat.TRANSLUCENT;
        mTabParams.height = TAB_BAR_HEIGHT;
        mTabParams.gravity = Gravity.BOTTOM;
        mWindowmanager = (WindowManager) getSystemService(Context.WINDOW_SERVICE);
        mWindowmanager.addView(mTabbarLayout, mTabParams);

Upvotes: 1

Views: 537

Answers (1)

Sylvain Lagache
Sylvain Lagache

Reputation: 91

This worked for me :

params = new WindowManager.LayoutParams( 
    WindowManager.LayoutParams.WRAP_CONTENT, 
    WindowManager.LayoutParams.WRAP_CONTENT, 
    WindowManager.LayoutParams.TYPE_PRIORITY_PHONE, 
    WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN | 
    WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE | 
    WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL | 
    WindowManager.LayoutParams.FLAG_SPLIT_TOUCH | 
    WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM, 
    PixelFormat.TRANSLUCENT);

This put the added view behind the keyboard.

Upvotes: 2

Related Questions