Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

EditText with number keypad by default, but allowing alphabetic characters

I have an EditText box and I want the default keyboard that comes up when it is selected to be the numeric keypad, since most of the time users will be entering numbers. However, I do want to allow users to enter alphabetic characters too, if they need to. Using android:inputType="number" restricts input to numeric digits only. What options do I have?

like image 725
Frank Bozzo Avatar asked Aug 23 '10 01:08

Frank Bozzo


1 Answers

Define your EditText in your xml this way:

<EditText      android:id="@+id/txtOppCodigoCliente"     android:inputType="textVisiblePassword"     android:layout_width="match_parent"     android:layout_height="match_parent"     android:maxLength="11"     android:hint="@string/strCodigoCliente"/> 

output: android:inputType="textVisiblePassword"

A row of numbers and the rest of letters.

like image 180
Diego Santamaria Avatar answered Oct 05 '22 03:10

Diego Santamaria