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来处理隐藏的属性。
补充:移动开发 , Android ,