Android 输入法(包括手写)补充

一、全屏设置

public void updateFullscreenMode() {

        ///将下面的变量isFullscrean置为false,问题解决。google也是这么解释的~~
        boolean isFullscreen = mShowInputRequested && onEvaluateFullscreenMode();//YES,IT IS HERE!!
        boolean changed = mLastShowInputRequested != mShowInputRequested;
        if (mIsFullscreen != isFullscreen || !mFullscreenApplied) {
            changed = true;
            mIsFullscreen = isFullscreen;
            InputConnection ic = getCurrentInputConnection();
            if (ic != null) ic.reportFullscreenMode(isFullscreen);
            mFullscreenApplied = true;
            initialize();
            LinearLayout.LayoutParams lp = (LinearLayout.LayoutParams)
                    mFullscreenArea.getLayoutParams();
            if (isFullscreen) {
                mFullscreenArea.setBackgroundDrawable(mThemeAttrs.getDrawable(
                        com.android.internal.R.styleable.InputMethodService_imeFullscreenBackground));
                lp.height = 0;
                lp.weight = 1;
            } else {
                mFullscreenArea.setBackgroundDrawable(null);
                lp.height = LinearLayout.LayoutParams.WRAP_CONTENT;
                lp.weight = 0;
            }
            ((ViewGroup)mFullscreenArea.getParent()).updateViewLayout(
                    mFullscreenArea, lp);
            if (isFullscreen) {
                if (mExtractView == null) {
                    View v = onCreateExtractTextView();
                    if (v != null) {
                        setExtractView(v);
                    }
                }
                startExtractingText(false);
            }
            updateExtractFrameVisibility();
        }
 
        if (changed) {
            onConfigureWindow(mWindow.getWindow(), isFullscreen,
                    !mShowInputRequested);
            mLastShowInputRequested = mShowInputRequested;
        }

    }

只需要 onConfigureWindow(mWindow.getWindow(), isFullscreen,
                    !mShowInputRequested);这个方法就可以设置是否全屏。

windwon是this.getWindow().getWindow();因为输入法的界面是dialog所以this.getWindow()得到的是dialog。isFullscreen来设置是否全屏,false取消全屏,true设置为全屏。二、输入法隐藏退出

继承方法

@Override
public void requestHideSelf(int flags) {
// TODO Auto-generated method stub
super.requestHideSelf(flags);
}

在需要隐藏处调用该方法,flags来处理隐藏的属性。

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值