Numeric Keyboard on close opens Alphanumeric keyboard - android

I am using inputType:number for EditText.
But the problem is that when I click on Done Button(Right Mark) present at bottom left of keyboard it opens up Alphanumeric keyboard.
My EDIT TEXT XML Code:
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/enter_detail"
android:hint="Enter Detail"
android:padding="20dp"
android:inputType="number"
android:textColorHint="#42a5f5"
android:textColor="#color/title_black"
app:layout_constraintTop_toBottomOf="#id/radio_group"/>
UPDATE
I have found that DATEPICKER with datePickerMode="spinner" is creating issue.
I switched to datePickerMode="calendar" and it solved the problem.
I think there is a problem with the DatePicker widget because when used spinner mode bottom part is incomplete(Please refer to this question to understand this problem: Android: Datepicker bottom part not visbile)
I have created GIF of the video:

How about replacing the inputType with "number|numberDecimal"
android:inputType="number|numberDecimal".

Related

android - edittext keyboard not showing

I am creating an edittext programmatically. But I was not able to type anything into the edittext. I have covered all the related answers on this site but none of them worked for me. Maybe I am missing some minor details. It would be helpful if I can get some help.
Code to create edittext dynamically:
EditText editText = new EditText(dt.c);
editText.setBackground(context.getResources().getDrawable(R.drawable.rectangle_answer));
editText.setTextColor(ContextCompat.getColor(dt.c, R.color.md_black_1000));
editText.setTextSize(16);
editText.setTag(questionDetails[0].getOptionId());
editText.setFocusable(true);
editText.setHint(dt.gStr(R.string.enter_your_answer));
editText.requestFocus();
container.Add(editText);
Some of the answers that I covered:
How can I set the focus (and display the keyboard) on my EditText programmatically
Android - EditText made programmatically not showing keyboard
Android: How to open keyboard for editing EditText when click button?
Disable keyboard on EditText
How to disable the keyboard when I click on EditText?
I was having the same problem and nothing worked until I found an answer way down in one of the posts from years ago that worked. I'll repost the weird hack for anyone who might have this problem in the future.
In your xml file, add a dummy edittext to your topmost layout layer that looks like this:
<EditText
android:id="#+id/editTextFix"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:importantForAutofill="no"
tools:targetApi="o"
android:inputType="text"
android:visibility="gone"/>
the dummy edittext will open the keyboard, but your programatically created edittext will still have focus.

Android: TextInputEditText showing text only after change focus

I have a big problem with a EditText that does not show any input until i change focus from element. When I click on the input, the keyboard appears and while i type, there is nothing displayed in the edit text view. The input is shown only when i close the keyboard
It is not a problem of colours. I mention that the view are contained in a constraint layout. I can enable hardware acceleration but this will slow down the application very much and it's not an option. I can however discard the constraint layout and change it to a linear layout but this will affect the rest of the code. I am sure that I am missing something, an easy fix, but i can't put my finger on it. Thanks a lot in advance
<android.support.design.widget.TextInputLayout
android:id="#+id/codeEditTextContainer"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="30dp"
android:layout_marginRight="30dp"
android:layout_marginBottom="20dp"
app:layout_constraintBottom_toTopOf="#id/verifyButton"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent">
<android.support.design.widget.TextInputEditText
android:id="#+id/codeEditText"
android:layout_width="match_parent"
android:inputType="text"
android:layout_height="wrap_content"
android:hint="#string/sms_code"
android:padding="10dp"
android:textColor="#color/white" />
</android.support.design.widget.TextInputLayout>
!!UPDATE
Found the problem, but still i have no answer. This problem is present only on Android Pie and only when the edit text is in the lower part of the screen and has to be raised by the soft keyboard. I already tried to add softInputWindowMode to adjustResize or adjustPan but this is not doing anything.
The problem itself is a duplicate to this question Android Pie edittext does not adjustPan/resize while typing
which still doesn't have an answer
The problem man be about hardwareAccelerated. I was having the same problem and waste too much time to solve before saw this page.
Android Pie edittext does not adjustPan/resize while typing

Keyboard with search icon

I have a SearchActivty in my application on which I have an EditText and a Button to search the items. I want the search icon to be displayed in keyboard for this EditText.
Right now I've imeOption = "actionSearch" inside my EditText layout which is right now giving "search" as text in the keyboard. I want instead of text there should be an icon. IS it possible to set search icon on place of text in keyboard. If yes then please help.
My EditText in layout is :
<EditText
android:id="#+id/txtUser"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:hint="type name here"
android:inputType="text"
android:singleLine="true"
android:imeOptions="actionSearch"/>
No, its not possible. The keyboard itself decides what should be shown where. Some keyboards will implement images for various imeOptions, some won't. But there's no way to force it.

Click on EditText won't show the keyboard?

I have a table whose tapping on a cell changes its content and displays some edit texts. The first of these edit texts requests the focus, but oddly when I tap on it, the keyboard doesn't show. It is when I tap the others edit texts though. What should I do? Here is how I implemented my first edit text.
<EditText
android:id="#+id/editContent"
android:layout_width="match_parent"
android:layout_height="120dp"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:layout_marginTop="5dp"
android:gravity="top"
android:inputType="textMultiLine" >
</requestFocus>
</EditText>
When I don't request the focus, there is also a strange behaviour: it opens the keyboard when I tap it but my edit text loses the focus and I've to tap it again to write in it.
I found the problem, it was because of this line in the Activity block of the Manifest :
android:windowSoftInputMode="stateHidden"
I changed it by :
android:windowSoftInputMode="adjustPan"
Works well now.

Soft Keyboard - Numeric Only

my question is kinda related to this question: Numeric Soft Keyboard on Android
BUT, the question above isnt answered, so here i am.
Theres a EditText that when it gets touched or has focus, i want the Software Keyboard to show up by default as NUMERIC! Of course, you can switch back to ALPHANUMERIC, but i want to force it to show up as NUMERIC.
Thanks guys
Use the android:inputType XML attribute with the number value:
<EditText android:id="#+id/edtInput"
android:layout_width="0dip"
android:layout_height="wrap_content"
android:inputType="number"/>

Categories

Resources