一、全屏設定
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();因為IME的介面是dialog所以this.getWindow()得到的是dialog。isFullscreen來設定是否全屏,false取消全屏,true設定為全屏。二、IME隱藏退出
繼承方法
@Override
public void requestHideSelf(int flags) {
// TODO Auto-generated method stub
super.requestHideSelf(flags);
}
在需要隱藏處調用該方法,flags來處理隱藏的屬性。