Change from number keypad to general keypad - android

In Some phones when number keypad is displayed unable to go back to normal keypad because in my scenario numbers are the primary for me so need number keypad to be displayed at first go later if we want to switch to normal keypad it's not working.
Mostly I observed this issue in Lenovo phones/tablets.
Edit: Basically iam using Digitkeylistener for some seperators to get added programatically if i make use of Textkeylistener its throwing n number crashes randomnly.So I want to use Digitkeylistener but with normal keypad.

Change inputtype attribute of your Edittext in XML, to text

You can add below line in your code
For Numeric,
editText.setRawInputType(Configuration.KEYBOARD_12KEY);
For Qwerty,
editText.setRawInputType(Configuration.KEYBOARD_QWERTY);
This is only to set input type but you can change keyboard and will not restrict Edittext to enter number only.

You can add below line in your XML for getting general keyboard:
android:inputType="text"
<EditText
android:layout_width="match_parent"
android:inputType="text"
android:layout_height="match_parent" />
You can add below line in your XML for getting Number keyboard:
android:inputType="number"

Related

Android: How to remove customize keyboard button from keyboard?

Please find below the screenshot wherein the circular box shows the customize button option.
XMl Code:
<EditText
android:id="#+id/et_cost_per_mile"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:hint="Cost Per Mile(₤)"
android:inputType="numberSigned"
/>
All I want to remove :: button from keyboard.
You have change input type like..
android:inputType="phone"
You can not. This is your android keyboard app and you cant change it. The keyboard settings can be modified in the android settings. But obviously it depends on the user, not the developer.
The only way I think it will allow you to do that is that you include in your app a fake numeric keypad as a layer (Similar to the keyboard that appears when you have to type the pin of the app of your bank). However, I don't think this is worth it. With...
android:inputType = "numberSigned"
you are already blocking the user from entering letters or other characters, even if they change their keyboard.

Enter key event not working on Numeric Input field?

I created two EditText with these two property.
android:digits="0123456789"
android:inputType="numberDecimal"
I use Hardware Keyboard, when I perform Enter Key, focus control not shifting from one view to next view, as it happen normal in EditText case. If I remove "android:digits" property then it work properly, but here it allow to insert decimal key also, that I don't want.
I tried with "android:nextFocusDown" proerty also, but that is also not working in this case.
Any one have idea how can use Enter key event to shift focus.
use
Either
android:inputType="number"
or
android:digits="0123456789"
PS :
best one is android:inputType="number" because it will automatically open the numeric keyboard
where as android:digits="0123456789" this will open simple keyboard
Add this to the layout:
android:singleLine="true"
You don't need android:inputType="numberDecimal", since you declared only digits in the android:digits="0123456789"

How to limit returns in a multiple line EditText?

I put a multiline EditText in my application. The problem is that if the user presses enter, the EditText often collides with the icons in my application. I want to avoid that.
I wanted to know how to make it so that the user can only press enter 5 times and no more?
To restrict the height of an EditText, you can use the maxLines attribute
<EditText
...
android:maxLines="5"
...
/>

Android SoftKeyBoard - rename the Enter Key

i have several EditText in my App. If you hit the Enter Key you can tab to the next EditText without a problem but i would like to change the Enter Key so that this button doesn't shows the Enter Simbol but instead it shows "Next" or "Done". i tried many things but without any results. Here is the XML code for my EditText:
<EditText
android:id="#+id/et_nt_name"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:gravity="top"
android:imeOptions="actionNext|flagNoEnterAction"
android:imeActionLabel="Next"
android:singleLine="true"
android:inputType="textShortMessage"
/>
it is the case that some soft keyboards actually change the default text on the enter key by design, so it may not be your fault that it's not showing what you want it to show. the functionality should be the what you programmed it to do, though.
i recommend you switch to the default keyboard (long press on any edit text, then select input method) to verify that it's showing the correct text, and don't care about the what the other soft keyboards look like .
if your phone didn't come with the default soft keyboard, the Android emulator is your best friend.
Add this to your EditText,
android:imeOptions="actionDone"

Why input type "number" is showing alphabet keyboard for an edit text...?

I have a edit text, whose input type is number.
in emulator its working fine i.e, showing the num-pad as soft keypad.
but in the device its showing alphabets keyboard why?
<EditText android:layout_width="110dp"
android:layout_height="30dp" android:id="#+id/phone"
android:layout_alignParentRight="true" android:background="#drawable/edit_text_bg"
android:inputType="number" android:maxLength="10"
android:paddingLeft="4dp" android:textColor="#1b0a00"
android:layout_marginRight="8dp"/>
Thanks in advance....!
So from what i've observed setting the inputType to phone should solve the problem . But try a different device to check if ur code works by giving input as number before moving to this option .
I think you must change inputType
FROM :
android:inputType="number"
TO:
android:inputType="phone"
When you give the InputType as number there is a completely new keyboard that gets loaded very different to what you will get by pressing the corner button on your normal keyboard to get numbers . Only certain phones/android versions(i think 2.2+) have this separate keyboard . For the ones that dont have this , The normal keyboard is shown and manual switching has to be done .
It could be that the device you're testing has some sort of custom keyboard enabled by default that doesn't support a number pad. Try changing the keyboard settings to the standard keyboard on the device and see if it works.

Categories

Resources