user1271519
user1271519

Reputation: 439

Enable email keyboard on android for input type email

I am creating application with WebView. I use the WebView to 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 WebView to show an email-friendly keyboard on Android, like you can on iPhone?

Upvotes: 19

Views: 30710

Answers (4)

Oscar Ivan
Oscar Ivan

Reputation: 949

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


 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.

Upvotes: 2

Andrea
Andrea

Reputation: 12944

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

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

This doesn't seem to work on Gingerbread.

Upvotes: 0

V.J.
V.J.

Reputation: 9590

You will only put

android:inputType="textEmailAddress" 

in your edittext box.

Upvotes: 29

vipin
vipin

Reputation: 3001

yes it is posible

in your Edittext xml just add the attribute

android:inputType="textEmailAddress"

see this for more

EditText, inputType values (xml)

Upvotes: 5

Related Questions