Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Numeric Keyboard for Android with Plus(+) char

I am developing App that has EditText in List Item View. which accept the numeric value and list of values with '+' sign. on submit a function is called which evaluate that string and adds the values present in that string separated by '+'. Now the problem is i had set


'inputType="number'


to the EditText box but in numeric keyBoard '+' sign is not present. I tried to use 'digits=0123456789+' but not worked

like image 589
Vinayak Khedkar Avatar asked Jun 29 '26 11:06

Vinayak Khedkar


2 Answers

If you'd like an input method for entering a phone number, use the "phone" value:

Use inputType="phone"

Reference here

like image 94
Zubair Ahmed Avatar answered Jul 01 '26 02:07

Zubair Ahmed


As Zubair suggested inputType="phone" popup perfect keyboard for me. But to avoid extra character I did use digits="0123456789+"

<EditText
                android:layout_width="wrap_content"
                android:layout_height="match_parent"
                android:id="@+id/enteramount"
                android:hint="Amount"
                android:textSize="@dimen/Heading"
                android:padding="5dp"
                android:layout_marginRight="5dp"
                android:inputType="phone"
                android:digits="0123456789+"
                android:background="@drawable/edit_text_bg"/>

This may be useful to someone.

like image 44
Vinayak Khedkar Avatar answered Jul 01 '26 01:07

Vinayak Khedkar



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!