Android imeOptions usage and precautions

Source: Internet
Author: User

Android imeOptions usage and precautions
In android development, it is essential to use the text box (EditText) for data input, which requires some control over the input method.
Android: inputType: Specifies the input method type. It can be an int type. | select multiple input methods. For the value, see the android. text. InputType class.
Optional values include text, textUri, phone, number, and so on.
Android: imeOptions: Specifies the Input key function in the window. The optional values are normal, actionUnspecified, actionNone, actionGo, actionSearch, actionSend, actionNext, and actionDone.

Some input methods may not support this well.

 

[Html]
  1. The following LAYOUT definition file provides some examples to illustrate the use of inputType and imeOptions.
  2. Android: layout_width = fill_parent android: layout_height = wrap_content
  3.  
  4. Android: hint = Normal text
  5.  
  6. Android: inputType = text
  7.  
  8. Android: imeOptions = actionNext
  9. />
  10. Android: layout_width = fill_parent android: layout_height = wrap_content
  11.  
  12. Android: hint = Integer only
  13.  
  14. Android: inputType = number
  15.  
  16. Android: imeOptions = actionNext
  17. />
  18. Android: layout_width = fill_parent android: layout_height = wrap_content
  19.  
  20. Android: hint = Decimal only
  21.  
  22. Android: inputType = numberDecimal
  23.  
  24. Android: imeOptions = actionNext
  25. />
  26. Android: layout_width = fill_parent android: layout_height = wrap_content
  27.  
  28. Android: hint = Phone number
  29.  
  30. Android: inputType = phone
  31.  
  32. Android: imeOptions = actionNext
  33. />
  34. Android: layout_width = fill_parent android: layout_height = wrap_content
  35.  
  36. Android: hint = Email
  37.  
  38. Android: inputType = textEmailAddress
  39.  
  40. Android: imeOptions = actionSend
  41. />
  42. Android: layout_width = fill_parent android: layout_height = wrap_content
  43.  
  44. Android: hint = Web Site
  45.  
  46. Android: inputType = textUri
  47.  
  48. Android: imeOptions = actionDone/>
  49. With inputType, the keyboard of the Input Method automatically changes. When inputType = number, English characters are not allowed.
  50. Note: android: phoneNumber, android: numeric, these attributes have been deprecated and many input methods are no longer supported. It is better to use inputType directly. In addition, it is best to use Google pinyin or android keyboard for such debugging. Otherwise, imeOptions may not be displayed normally. For example, Baidu input method does not support imeOptions until I delete it.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.