gpt4 book ai didi

android - webview 中的软键盘 - 没有 "next"按钮可以在输入字段之间切换

转载 作者:塔克拉玛干 更新时间:2023-11-02 20:33:00 25 4
gpt4 key购买 nike

当我聚焦 webview 输入字段时,我的软键盘不显示此按钮。找不到任何关于启用此功能的特殊设置 - 我是否遗漏了什么?它不会出现在任何类型的输入字段(字母/数字)中。

安卓版本 4.0.3

提前致谢!

最佳答案

这是对我有帮助的(Nexus 4 和 Nexus 5 with Android 4.4.*),使用自定义 WebView 并从 onCreateInputConnection() 覆盖 EditInfo:

private static class CustomWebView extends WebView {

public CustomWebView(Context context) {
super(context);
}

@Override
public InputConnection onCreateInputConnection(EditorInfo outAttrs) {
InputConnection inputConnection = super.onCreateInputConnection(outAttrs);
if (outAttrs != null) {
// remove other IME_ACTION_*
outAttrs.imeOptions &= ~EditorInfo.IME_ACTION_GO;
outAttrs.imeOptions &= ~EditorInfo.IME_ACTION_SEARCH;
outAttrs.imeOptions &= ~EditorInfo.IME_ACTION_SEND;
outAttrs.imeOptions &= ~EditorInfo.IME_ACTION_DONE;
outAttrs.imeOptions &= ~EditorInfo.IME_ACTION_NONE;
// add IME_ACTION_NEXT instead
outAttrs.imeOptions |= EditorInfo.IME_ACTION_NEXT;
}
return inputConnection;
}
}

关于android - webview 中的软键盘 - 没有 "next"按钮可以在输入字段之间切换,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16686681/

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