首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 移动开发 > Android >

Android Framework系列之IMF(3)

2012-08-22 
Android Framework系列之IMF(三)原创文章,转载请标注出处----?我们知道当一个编辑框获得焦点的时候,将会cr

Android Framework系列之IMF(三)

原创文章,转载请标注出处----

?

我们知道当一个编辑框获得焦点的时候,将会create一个新的IME客户端,那么IMF框架是怎样处理这个事件的呢?

?

首先调用EditText的构造函数EditTex->TextView->setText()???????????

?那么到了IME部分的流程又是如何的呢?

首先收到configure change的event调用onConfigurationChanged->inputmethodservice.onConfigurationChanged(conf)

 @Override public void onConfigurationChanged(Configuration newConfig) {        super.onConfigurationChanged(newConfig);                boolean visible = mWindowVisible;        int showFlags = mShowInputFlags;        boolean showingInput = mShowInputRequested;        CompletionInfo[] completions = mCurCompletions;        initViews();        mInputViewStarted = false;        mCandidatesViewStarted = false;        if (mInputStarted) {            doStartInput(getCurrentInputConnection(),                    getCurrentInputEditorInfo(), true);  //调用startinput,创建IME的input        }        if (visible) {            if (showingInput) {                // If we were last showing the soft keyboard, try to do so again.                if (onShowInputRequested(showFlags, true)) {                    showWindow(true);                    if (completions != null) {                        mCurCompletions = completions;                        onDisplayCompletions(completions);                    }                } else {                    hideWindow();                }            } else if (mCandidatesVisibility == View.VISIBLE) {                // If the candidates are currently visible, make sure the                // window is shown for them.                showWindow(false);            } else {                // Otherwise hide the window.                hideWindow();            }        }    }

?doStartInput->initialize->onInitializeInterface->onStartInput->onStartInputView.

onStartInputView中会handle各种IME的event并进一步调用IME自身的onCreate函数,做进一步的初始化以及receiver的rigister。

?

热点排行