I want to get only decimal keyboard like this :
But I get this :
and this is what I do
<EditText
android:imeOptions="actionDone"
android:inputType="phone"
android:digits="0123456789,."
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/funding_amount"
android:layout_marginTop="8dp"
android:background="#drawable/bt_state_blue_light"
android:hint="#string/pln_amount_placeholder"
android:minHeight="40sp"
android:padding="5dp"
android:textColor="#color/background_tutorial"
android:textColorHint="#color/text_color_tutorial"
android:textSize="#dimen/text_dp_16" />
if I change I get this :
android:digits="0123456789"
android:inputType="numberDecimal"
You need to create a custom keyboard of android that can input number decimals. Check this link to make your own custom keyboard How can you make a custom keyboard in Android? or Using Library like here
Related
I am creating signup page but and adding next button to every TextInputEditText and it is working perfectly without any issue,
but whenever I add android:digits="0123456789qwertzuiopasdfghjklyxcvbnm_ " in layout then it doesn't work.
What will be the probable reason for the solution for it??
below is my code snippet.
<com.google.android.material.textfield.TextInputLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:textColorHint="#c0c0c0"
app:errorEnabled="true"
app:theme="#style/MyTextInputLayoutStyle">
<com.google.android.material.textfield.TextInputEditText
android:id="#+id/activity_register_edit_text_state"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10"
android:hint="#string/state_region"
android:imeOptions="actionNext"
android:digits="0123456789qwertzuiopasdfghjklyxcvbnm_ "
android:inputType="textPersonName"
android:padding="#dimen/edittext_padding"
android:textColor="#color/text_color_light"
android:theme="#style/MyTextInputLayoutStyle"
app:errorTextAppearance="#style/TextErrorAppearance"
app:xfont="#string/roboto_regular" />
</com.google.android.material.textfield.TextInputLayout>
Thanks in advance.
When you set android:digits in EditText orTextInputEditText, it allows only digit or character which you have defined in it. In android soft input (Key Board) there is the next button have a unique code that is not defined in android: digits.
refer this link for better understanding
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!
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.+-*/%()"
/>
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="phone"
android:digits="0123456789.+-*/"
android:id="#+id/inputs"
/>
Try setting input type to your EditText
<EditText android:inputType="number" ... />
EDIT
There's another option for better customization here
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>
I want to open only numeric keyboard with input type numeric password. Code is as follows.
<EditText
android:id="#+id/passcode1"
android:layout_width="90dp"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="30dp"
android:cursorVisible="false"
android:gravity="center_vertical|center_horizontal"
android:imeOptions="actionNext"
android:inputType="numberPassword"
android:maxLength="4"
android:singleLine="true" />
Everything working great but Soft Keyboard opens with special symbols and numeric digits. I want only numeric digits must be visible there.
Thanks.
Please change android:inputType="numberPassword"
to
android:inputType="number|textPassword"
I had an issue with setting hint in Arabic language. Please refer Alternating edit text hint not visible for Arabic language
for details. The issue was with the use of inputType in the xml. I have removed it and now a normal keypad appears onclick of the edittext field. But I want the user to enter numbers only and I want numerical keypad to appear. How to do it?
In short, the use of inputType will not display the Arabic content and if it is not used then I am getting alphabetical keypad.
Please help, thanks in advance
hope you can use this property android:numeric="integer" and please remove singleline property if you are using it.
<EditText
android:id="#+id/et_account_no"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="#android:color/transparent"
android:cursorVisible="true"
android:gravity="right"
android:hint="#string/hint_account_no"
android:imeOptions="actionNext"
android:numeric="integer"
android:maxLength="12"
android:textColor="#android:color/black"
android:textSize="20sp"
android:padding="#dimen/edittext_padding">
</EditText>
Use android:inputType="number" or android:inputType="phone" it should give you numeric keypad on click of edit text:
Following is the snippet from my xml, this should help:
<EditText
android:layout_gravity="start"
android:textAlignment="viewStart"
android:hint="my hint"
android:inputType="phone"
android:id="#+id/Nummm"
android:paddingStart="8dp"
android:paddingLeft="8dp"
android:textDirection="rtl"
android:gravity="center_vertical"
android:layout_width="match_parent"
android:background="#android:color/transparent"
android:textColorHint="#767676"
android:backgroundTint="#android:color/transparent"
android:layout_height="fill_parent"
tools:ignore="RtlCompat" />
In Android, how can I make the keypad that is displayed for user input, display a number keypad "123456789.+-", instead of the default QWERTY keyboard? I need it to display this for ease of data entry.
<EditText
android:id="#+id/etCYLl"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="5dp"
android:layout_weight="1"
android:background="#drawable/myedittext"
android:ems="10"
android:inputType="numberDecimal|numberSigned"
android:digits="0123456789.+-"
android:nextFocusForward="#+id/etAXEl"
android:paddingLeft="5dp"
android:paddingRight="5dp"
android:singleLine="true" />
You need to write a keyboard to use for the app. You can change the custom keys used in the keyboard, check here: http://www.droid-life.com/2010/04/22/create-your-own-custom-htc_ime-keyboard/