Android Edittext insert negative number -
It is often asked here like this
I have set up an editor:
Android: layout_height = "wrap_content" Android: layout_weight = "0.3" Android: inputType = "number decimal: number personal" Android: text: & lt; Edittext android: android: android: layout_width = "wrap" = "0" /> When attempting to insert a negative number, I "-" include it by pressing, but it will not allow me to include any other digit!
Is this a bug?
The answer is simple: this is not a bug, it is a programmer!
I only publish it to help others.
I have an input filter applied to the text ...
Edvarmin. Set filter (new input filter [] {new decimal integator (7, 2)}); Here is the permission to give a signal to the digits
public square decimals input input filter filter (pattern mPattern; public decimal entries inputfilter (int numeric expression, intextifterzero) {mPattern = Pattern.compile ("[- +] [0- 9] {0," + (digitizer-zero-1) + "} + ((\\. [0- 9] {0," + (digit- Zero-1) + "})?) || (\.)?");} @ Override Public Charsequence Filter (Charsequence source, int start, int end, spanned dest, int dstart, int dend) {mater matcher = MPattern.matcher (dest); if (Matche! R.matches ()) "" return; return tap;}}
Comments
Post a Comment