Android教程網
  1. 首頁
  2. Android 技術
  3. Android 手機
  4. Android 系統教程
  5. Android 游戲
 Android教程網 >> Android技術 >> 關於Android編程 >> Android 輸入法(包括手寫)補充

Android 輸入法(包括手寫)補充

編輯:關於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來處理隱藏的屬性。

 

  1. 上一頁:
  2. 下一頁:
熱門文章
閱讀排行版
Copyright © Android教程網 All Rights Reserved