Home > database >  Android EditText number pad keyboard with version like filter(TextWatcher)
Android EditText number pad keyboard with version like filter(TextWatcher)

Time:04-09

EditText should accept input like "1.0.1" means multiple "."s. and keyboard should be number pad(I know EditText's inputType should be numberDecimal).

enter image description here

But numberDecimal only accepts single dot and the filter won't work for this. How to solve this???

CodePudding user response:

I think you could just add . to EditText android:digits xml value

Like so :

<EditText
   android:layout_width="match_parent"
   android:layout_height="wrap_content"
   android:digits="0123456789."
   android:inputType="numberDecimal" 
/>
  • Related