tags:

views:

201

answers:

2

I have an EditText box and I want the default keyboard that comes up when it is selected to be the numeric keypad... however, I do not want to prohibit letters from being entered (as the "numbers" InputType does). What InputType should I use?

A: 

You need to add the following property to your EditText

Edit--

Sorry i did nt read your question properly. What do you mean by i do not want to restrict user from entering alphabets? You want them to appear or not? . If you want to display only numbers there you can select phone as inputtype.

Rahul
A: 

Basically, EditText inputtype is used to set the input type in your EditText.

The possible values for the android:inputtype are:

  • text
  • textCapCharacters
  • textCapWords
  • textCapSentences
  • textAutoCorrect
  • textAutoComplete
  • textMultiLine
  • textImeMultiLine
  • textNoSuggestions
  • textUri
  • textEmailAddress
  • textEmailSubject
  • textShortMessage
  • textLongMessage
  • textPersonName
  • textPostalAddress
  • textPassword
  • textVisiblePassword
  • textWebEditText
  • textFilter
  • textPhonetic
  • number
  • numberSigned
  • numberDecimal
  • phone
  • datetime
  • date
  • time

then you can use any value as showing in example:

<EditText android:id="@+id/EditText01"
 android:layout_height="wrap_content"
 android:layout_width="fill_parent"
 android:inputType="number"
 android:text="1212223"/>
PM - Paresh Mayani