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/
Related
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
<EditText
android:layout_marginTop="10dp"
android:id="#+id/etUsername"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="#string/username"
android:background="#anim/custom_edit_text"
android:textColor="#android:color/black"
/>
this is my edit text and when I tap on it because of the keyboard the exittext can not be seen anymore, on my galaxy s3 the IME goes fullscreen, extracts UI and it's working perfectly, but on other platforms the keyboard appear over the 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 did the following code in my program:
<RelativeLayout
....>
<EditText
android:id="#+id/EditText"
android:layout_width="150dp"
android:layout_height="37dp"
android:layout_below="#+id/Header"
android:layout_toRightOf="#+id/Button"
android:inputType="number"
android:textSize="14dp" />
</RelativeLayout>
but whenever I tried it on my app, the app will first pop out the numeric keypad, and then a sec later, it will changed to alphabet keypad and the edittext is no longer on focus.
Can anyone help? Thanks!
It sounds like somewhere in your layout or UI code something else is using requestFocus, perhaps another input field that is not of type number.
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" />