在webview表单中隐藏键盘中的表情符号

问题描述 投票:0回答:2

我正在使用显示表单的WebView。当我点击输入字段时,android系统会显示一个softKeyboard。

比,我怎么能显示纯文字键盘?因为现在,在键盘上我可以看到表情符号按钮,我想隐藏它。

使用自定义WebView我可以覆盖onCreateInputConnection但我只能设置类型但不能隐藏表情符号。

android android-webview android-softkeyboard
2个回答
0
投票

我知道这不是一个好的解决方案。但是,在找到最佳解决方案之前,它会很有用。

将以下属性添加到xml

android:digits="qwertyuiopasdfghjklzxcvbnm 1234567890 QWERTYUIOPASDFGHJKLZXCVBNM"

<EditText
            android:digits="qwertyuiopasdfghjklzxcvbnm 1234567890 QWERTYUIOPASDFGHJKLZXCVBNM"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"/>

0
投票

您应该创建自定义WebView并覆盖onCreateInputConnection,如下所示:

@Override
public InputConnection onCreateInputConnection(EditorInfo outAttrs) {
        InputConnection connection = super.onCreateInputConnection(outAttrs);
        outAttrs.inputType =InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD;
        return connection;
}
© www.soinside.com 2019 - 2024. All rights reserved.