添加视图到windowManager,尊重软键盘InputMode =" adjustPan"

时间:2014-10-20 15:05:15

标签: android android-softkeyboard android-windowmanager

我已经向windowManager添加了一个停留在窗口上方的视图,但是当软键盘出现mode =“adjustPan”时(我希望保持这样),并向上移动窗口,添加的视图不会移动它,我怎么能强迫它移动?这是我的代码:

private void drawLogoAboveAll() {

        changeActionBarTextMarginLeft((int) PxToDp.convertDpToPixel(36, this));
        mLogo= new ImageView(this);

        mLogo.setImageResource(R.drawable.dvor_logo_plain);
        mLogoParams = new WindowManager.LayoutParams(
                (int) PxToDp.convertDpToPixel(50, this),
                (int) PxToDp.convertDpToPixel(50, this),
                WindowManager.LayoutParams.TYPE_APPLICATION,
                WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE|WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN
                        | WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL,
                PixelFormat.TRANSLUCENT);
        mLogoParams.gravity = Gravity.TOP | Gravity.START;
        mLogoParams.x = (int) PxToDp.convertPixelsToDp(10, this);
        mLogoParams.y = (int) PxToDp.convertPixelsToDp(20, this);
        windowManager.addView(mLogo, mLogoParams);
        mDvorLogo.setOnClickListener(new OnClickListener() {

            @Override
            public void onClick(View v) {
                onOptionsItemSelected(homeItem);
            }
        });

    }

0 个答案:

没有答案