在 android 上为输入类型的电子邮件启用电子邮件键盘

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/10206295/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-20 02:51:48  来源:igfitidea点击:

Enable email keyboard on android for input type email

androidhtmlemailinputandroid-webview

提问by user1271519

I am creating application with WebView. I use the WebViewto show HTML pages, containing input fields. If the HTML input fields expect an email address to be typed by the user, then I want to enable an email-friendly keyboard layout. Is it possible to set up the HTML or the WebViewto show an email-friendly keyboard on Android, like you can on iPhone?

我正在创建应用程序WebView。我使用WebView来显示包含输入字段的 HTML 页面。如果 HTML 输入字段希望用户输入电子邮件地址,那么我想启用电子邮件友好的键盘布局。是否可以WebView像在 iPhone 上一样在 Android上设置 HTML 或显示电子邮件友好的键盘?

回答by V.J.

You will only put

你只会把

android:inputType="textEmailAddress" 

in your edittext box.

在您的编辑文本框中。

回答by vipin

yes it is posible

是的,这是可能的

in your Edittext xml just add the attribute

在您的 Edittext xml 中只需添加属性

android:inputType="textEmailAddress"

see this for more

看这个了解更多

EditText, inputType values (xml)

EditText、inputType 值 (xml)

回答by Andrea

You can use the HTML5 input type email, which on recent Android versions brings up a qwerty keyboard with additional @and .keys.

您可以使用 HTML5 输入类型email,它在最近的 Android 版本上会显示带有附加@.键的 qwerty 键盘。

<input type="email" name="myinput" />

This doesn't seem to work on Gingerbread.

这似乎不适用于 Gingerbread。

回答by Oscar Ivan

just add this for your EditText or TextInputEditTex or whatever editable field.

只需为您的 EditText 或 TextInputEditTex 或任何可编辑字段添加它。


 this.inputType = (InputType.TYPE_CLASS_TEXT or InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS )

Note:if when you try to specify the input type and doesn't work put inside one "onFocusListener", i had the same problem.

注意:如果当您尝试指定输入类型并且在一个“onFocusListener”中不起作用时,我遇到了同样的问题。