Reputation: 1399
I have an edittext that I want to accept positive and negative numbers.
It works phone on my phone, the keyboard shows the "-" sign, however it doesn't work on some phone whereas the "-" doesn't show up on their keyboard. See the attached images. How to fix it so that it works on all Android phones. I set the edittext to android:inputType="numberDecimal|numberSigned" The first image is on my phone whereas the 2nd image shows the user's phone and he's having problem entering the "-" sign. He uses Android version 5.0.1.
<EditText
android:id="@+id/number"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:inputType="numberDecimal|numberSigned"
/>
Thank you.
Upvotes: 1
Views: 1053
Reputation: 7479
Moving my comment to the answer:
I can see the
-
on both images. Probably on the lower one you need to hold the button for it though.
It worked, holding the button selects the -
.
Upvotes: 2
Reputation: 39873
On the second keyboard the -
can be found as option on the )
key. So you did everything right. Setting android:inputType="numberDecimal|numberSigned"
should suffice. But eventually you might find keyboards not handling these types correctly. But then there's nothing you could do about it anyway.
Upvotes: 0