1

関数pickSuggestionManually(int index) では、コメント付きのドキュメントには次のように記載されています。

// If we were generating candidate suggestions for the current
// text, we would commit one of them here.  But for this sample,
// we will just commit the current text.
commitTyped(getCurrentInputConnection());

では、候補の提案の 1 つをコミットする方法は?

誰でも助けてもらえますか?

よろしく、サヤンタン

4

1 に答える 1

5

次のような関数を追加します。

public String getSuggestion(int index)
{
    return index >= 0 && mSuggestions != null && index < mSuggestions.size() ? mSuggestions.get(index) : "";
}

CandidateView.javaに移動し、参照したコードを次のようなものに置き換えます。

        if (mCandidateView != null) {
            getCurrentInputConnection().commitText(
                    mCandidateView.getSuggestion(index),
                    mCandidateView.getSuggestion(index).length());
            mComposing.setLength(0);
            updateCandidates();
        }
于 2011-04-24T14:31:11.823 に答える