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"
Related
My question is simple: I want to show a NumberPad keyboard on my android app without text preview and "Done" button. Just like the keypad that is shown on WhatsApp when user submits his phone number.
I hope the answer would be a simple one too! :)
You should try with textNoSuggestions
android:inputType="textNoSuggestions"
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:imeOptions="actionDone"
android:inputType="numberPassword"
android:maxLength="10"
android:maxLines="1"
android:padding="10dp"
android:singleLine="true"
android:textColor="#android:color/black" />
android:inputType="numberPassword"
I have few EditText in a same screen. Next soft key button is not there. Enter soft key is there but, it was not going to next EditText whenever I am pressing on that button. And after last EditText reached, I want to hide the soft keyboard. What should I do to achieve that. I found many questions and solution in stackoverflow. Nothing working for me.
Edittext Code:
<EditText
android:id="#+id/vehicle_number"
android:layout_width="fill_parent"
android:layout_height="40dp"
android:imeOptions="flagNoExtractUi|actionNext|actionGo|actionDone"
android:paddingLeft="5dp"
android:textSize="25dp"
android:maxLength="12"
android:hint="GA-00-A0000"
android:digits="1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ-"
android:nextFocusForward="#+id/vehicle_color"
android:inputType="textCapCharacters"
android:background="#drawable/edittext_rect_yellow_border" />
Tried java code also,
vehicle_number.setNextFocusDownId(R.id.vehicle_color);
I fixed myself. The solution is below. Now the 'Next' soft key displaying.
Removed
android:inputType="textCapCharacters"
Added
android:maxLines="1"
android:singleLine="true"
For Capital Characters
vehicle_number.setInputType(InputType.TYPE_TEXT_FLAG_CAP_CHARACTERS);
Solution
<EditText
android:id="#+id/vehicle_number"
android:layout_width="fill_parent"
android:layout_height="40dp"
android:imeOptions="flagNoExtractUi"
android:paddingLeft="5dp"
android:textSize="25dp"
android:maxLength="12"
android:hint="GA-00-A0000"
android:maxLines="1"
android:singleLine="true"
android:digits="1234567890qwertyuioplkjhgfdsazxcvbnm-"
android:background="#drawable/edittext_rect_yellow_border" />
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/
Android Soft keyboard is not automatically switching to Alphabet mode from numeric mode during navigating to other text box, why?
android:inputType="select ur appropriate mode"
for your particular textbox
example ,shown below
<EditText
android:id="#+id/editText1"
android:inputType="text"=========returns text keyboard
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<EditText
android:id="#+id/editText1"
android:inputType="number"=======returns numeric keyboard
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
You have to use the inputType property to indicate what type of keyboard you want.
For example, say you have 2 edit boxes:
//alphabet keyboard is shown when user focus is on this box
<EditText
android:id="#+id/editText1"
android:inputType="text"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
//numeric keyboard is shown when user focus is on this box
<EditText
android:id="#+id/editText2"
android:inputType="number"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />