gpt4 book ai didi

android - 如何在示例软键盘中提交候选项目?

转载 作者:行者123 更新时间:2023-11-29 15:32:04 26 4
gpt4 key购买 nike

在函数中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());

现在,如何提交候选建议之一?

有人可以帮忙吗?

问候,萨彦丹

最佳答案

添加一个函数,例如:

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();
}

关于android - 如何在示例软键盘中提交候选项目?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5448625/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com