Masked Input Using EditText Widget in Android

后端 未结 6 952
花落未央
花落未央 2020-12-01 12:48

Is there a way I can specify an input mask to the EditText control in Android?

I want be able to specify something like ### - ## - #### for a Social Security Number.

6条回答
  •  猫巷女王i
    2020-12-01 13:13

    The easiest way I know to use a mask on EditText in your Android programs in Android Studio is to use MaskedEditText library (GitHub link). It's a kind of custom EditText with Watcher that allows you to set a hint with different color (if you want it will be available even when user already started to type), mask and it's very easy to use :-)

    compile 'ru.egslava:MaskedEditText:1.0.5'
    
    
    

    And that is!

提交回复
热议问题