Reputation: 41
I have an EditText with inputType = text, because a math expression can be entered.
I would like to have a keyboard that shows numbers along with +, %, - and *.
Not sure what that kind of keyboard is called.
Is there a way for me to set it up without having to change inputType to number.
Thanks!
Upvotes: 0
Views: 1349
Reputation: 325
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="phone"
android:digits="0123456789.+-*/"
android:id="@+id/inputs"
/>
Upvotes: 1
Reputation: 38098
Use
<EditText
android:id="@+id/editText1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10"
android:inputType="numberDecimal|numberSigned"
android:digits="0123456789.+-*/%()"
/>
Upvotes: 1
Reputation: 12042
AndroidDoc Use the inputType numberDecimal|numberSigned
for calculator
<EditText
android:id="@+id/editText1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10"
android:inputType="numberDecimal|numberSigned" >
</EditText>
Upvotes: 0