简体   繁体   中英

Android: Set alphanumeric keyboard to show numeric first in EditText

I'm implementing an Android App and I need a tip. My EditText , usually, is just numbers, but sometimes numbers and letters.

This is the keyboard that I need as "default", when the EditText is focused:

数字键盘

If I put android:inputType="phone" or android:inputType="number" , the result isn't what I need:

手机布局键盘

I need numbers and letters. So, is it possible to do? I already tried EVERY inputType . I try to "mix" some inputType s, like, number | text number | text , but nothing changes.

try this

android:inputType="textVisiblePassword"

source

If you want a general keyboard you can use this:

android:inputType="text"

This will allow you to use default keyboard with all the special characters, numerics and alphabets one needs.

Looking at the date when this question was asked no doubt it was a hassle to feed the type of keyboard desired. Anyways, if you are still tracking this question. Here's the answer.

<EditText android:inputType="number" ... /> 

Above code must need 1.5 or up version if its not working also try

EditText num = new EditText(this);
num.setInputType(InputType.TYPE_CLASS_NUMBER);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM