Search code examples
androidandroid-edittext

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


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???


Solution

  • 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" 
    />