I'm having a problem with an EditText (only on QVGA devices, I've tested it on the QVGA emulator and on a Samsung i5500).
When the user clicks on the EditText and the soft keyboard comes up, only the first letter that the user enters appears on the field. The others only show up when the user closes the keyboard or some other event happens.
I don't know if this is a bug (it works on the higher res emulator), but is there any workaround I can use to give a better experience to my users right now?
My (messy) code is here:
https://github.com/bani/SMS-Denuncia/tree/master/android/
And the EditText I'm having a problem with is at
https://github.com/bani/SMS-Denuncia/blob/master/android/res/layout/local.xml
<EditText android:id="#+id/vagao2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:maxLength="12"
android:textSize="18sp"
android:text=""
android:imeOptions="actionSend"
android:visibility="invisible" />
Somehow it got fixed when I surrounded my layout with ScrollView.
Related
I created an EditText that only allows numbers as an input. It's a very simple EditText with nothing special:
<EditText
android:id="#+id/editTextAmount"
android:layout_marginTop="10dp"
android:layout_width="100dp"
android:layout_height="wrap_content"
android:background="#color/colorWhite"
android:inputType="text"
android:digits="0123456789"
/>
I tried it on a few devices and it's working as expected, I can enter only numbers. The issue arise when using a Samsung Galaxy Note S10+ (with a Samsung keyboard, I think the issue comes from there). With that device when I focus the EditText the keyboard opens (with only number visible) but when I type something in the field nothing happens. I can press any key from the keyboard (enter key, numbers, ...) nothing changes.
I tried to change the input type programmatically in the activity, I tried to fiddle with the inputType (numberDecimal, numberSigned, both, ...) in any case it is simply not working. The interesting thing is that if I change the inputType to "text" and remove the digits restriction then it is working perfectly.
My question is: How can I limit the EditText input to numbers with a Samsung Galaxy Note S10+?
EDIT: Just to make it perfectly clear, I am asking this for a specific device! I already tried:
android:inputType="number"
And
editText.setInputType(InputType.TYPE_CLASS_NUMBER);
And
any variation of those (numberDecimal, numberSigned, ...)
in Java class set input type like this
editText.setInputType(InputType.TYPE_CLASS_NUMBER);
or if you want to do that from layout then set
android:inputType="number"
It seems to work well with this configuration:
android:digits="0123456789"
android:inputType="phone"
That's a good enough workaround for me.
Below is my code for EditText,
<com.google.android.material.textfield.TextInputLayout
android:id="#+id/password_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#id/username_layout"
android:layout_marginTop="10dp"
android:layout_marginBottom="15dp"
app:hintEnabled="false"
app:passwordToggleEnabled="false"
app:passwordToggleTint="#color/white">
<com.google.android.material.textfield.TextInputEditText
android:id="#+id/login_password_input"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#id/login_username_input"
android:layout_weight="0.0"
android:drawableEnd="#drawable/password"
android:background="#drawable/round_bg"
android:hint="#string/login_password_hint"
android:imeActionLabel="#string/action_done"
android:imeOptions="actionDone"
android:inputType="textPassword"
android:maxLines="1"
android:nextFocusDown="#+id/submit_btn"
android:paddingStart="10dp"
android:paddingLeft="10dp"
android:text=""
android:textColor="#FFFFFF"
android:textColorHint="#FFFFFF"
android:textCursorDrawable="#null"
tools:ignore="RtlSymmetry" />
</com.google.android.material.textfield.TextInputLayout>
I am setting password eye icon programatically like below,
passwordLayout.setEndIconMode(TextInputLayout.END_ICON_PASSWORD_TOGGLE);
passwordLayout.setEndIconDrawable(GetDrawable.getDrawable("Show/Hide Password"));
passwordLayout.setEndIconTintList(ColorStateList.valueOf(getResources().getColor(R.color.color_white)));
This works fine in most of the devices. But getting below issue in Mi a2 Android Version 10.
I have two TextInputLayout for user name and password field
There is no issue while typing username field.
Next moved to password field. Now, the cursor stucked in first position and typing text is showed up in keyboard but not displayed in Edittext field. Only text is displayed after tapping somewhere else in screen
I am not sure why this happens in some devices
Found below question related to my issue. But no solution provided there.
TextInputEditText is not showing the typed text/number when typing
UPDATE
In this given a solution for my issue, Android Pie edittext does not adjustPan/resize while typing but using Hardware acceleration may lead to high memory usage. So afraid to use this solution.
is there any other way to solve this?
I tested the code on emulator on two android devices find nothing wrong with it used com.google.android.material:material:1.3.0
please update your color style it has no Legiblity
pan Adjuesment related issued loged in debug check that
try alpha or Rc MDC for libaray version bug
Finally you do is open issue at MDC github here
I want the soft keyboard in my app to show Done when clicking on a particular EditText. This is how it looks
<EditText
android:id="#+id/code_editText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#id/enter_code_textView"
android:layout_marginStart="#dimen/margin_25dp"
android:layout_marginLeft="#dimen/margin_25dp"
android:layout_marginTop="#dimen/margin_12dp"
android:layout_marginEnd="#dimen/margin_25dp"
android:layout_marginRight="#dimen/margin_25dp"
android:background="#drawable/edittext_background"
android:maxLines="1"
android:inputType="text"
android:imeOptions="actionDone"
android:textColor="#color/black"
android:textCursorDrawable="#null"
android:textSize="16sp" />
But this doesn't work. The soft keyboard enter key text doesn't change at all. I tried this on multiple devices, one Oreo and one KitKat. I also tried using singleLine attribute but that doesn't work too. What am I missing here? Thanks in advance!
There's no way to force the soft keyboard to show any key, not even the imeOptions. The keyboard app uses that as a hint- it doesn't have to honor it. And remember that every different keyboard will make different choices on whether or not to honor it. And that there is no such thing as the "default keyboard" as many OEMs replace it. Basically, you can set the imeOptions and hope it works, but there's no way to force it to work across all devices and keyboard apps.
I set imeoptions="actionDone" for my EditText in xml and everything works fine on a Medion Lifetab or Nexus 4 (on press "Enter" the softkeyboard disappears).
But I need this to work on a Honeywell Dolphin e70. On this device if I press "Enter" the next EditText gets focus. I already tried to set singleline true but didnt change the behavior.
This is the EditText I use:
<EditText
android:id="#+id/id1"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight=".55"
android:imeOptions="actionDone"
android:inputType="textCapSentences"
android:selectAllOnFocus="true"
android:textSize="#dimen/dimen1" />
Like I said, on other devices it works like intended.. Anyone got an idea for a workaround or where I can start handling this? I definetly dont want to set a keylistener to EVERY damn EditText is the application, that would totaly be an overkill..
thanks
You can see Close/hide the Android Soft Keyboard to hide the keyboard and Android Use Done button on Keyboard to click button to catch the dome button action.
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.