I am making a calculator and I want to make sure that user is able to enter a "Negative Decimal Number" I see the option in the xml file separately for example in order to put the Decimal Number, the EditText's inputType must be numberDecimal and for negative number the inputType must be "numberSigned" but I need both. If I choose inputType as "text" then user is able to enter anything which throws an exception if it's not a number. I am not sure how to fix that either.
You can use both with the "|" operator. Just specify "numberSigned|numberDecimal".
Add this in the layout of the EditText
:
android:digits="0123456789-."
You can specify more there, for example if you want the user to input sin()
functions.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With