tags:

views:

73

answers:

2

Hello.
what's the best way to mask a EditText on Android?
I Would like my EditText to behave like this decimal number input here. Is there a easy way to do this?

A: 

I think you can use:

android:numeric="decimal"

on your EditText

Serhiy
That would only avoid characters not allowed in decimal numbers. Not actually a mask
marcos
+1  A: 

You have to programmatically set an InputFilter on your EditText by setFilters.

From the documentation:

InputFilters can be attached to Editables to constrain the changes that can be made to them.

You can even change the users input, for example by adding a decimal point which is what you want if I get you correctly.

pivotnig