question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

TextInputEditText losing focus

See original GitHub issue

Description: TextInputEditText where the inputType=“numberDecimal” inside ReyclerView item losing focus after keyboard popup so user can not enter any number value.

Expected behavior: User can enter numbers without any problem https://youtu.be/qt21EWerrLI

Source code: <com.google.android.material.textfield.TextInputLayout android:id="@+id/itemDeliveredOrder_til_amount" style="@style/DeliveredOrderTextInputLayoutStyle" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_marginStart="16dp" android:layout_marginEnd="16dp" app:layout_constraintEnd_toStartOf="@+id/guideline3" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent"> <com.google.android.material.textfield.TextInputEditText android:id="@+id/itemDeliveredOrder_tie_amount" style="@style/DeliveredOrderTextInputLayoutStyle" android:layout_width="match_parent" android:imeOptions="actionDone" android:layout_height="wrap_content" android:hint="@string/amount" android:inputType="numberDecimal" /> </com.google.android.material.textfield.TextInputLayout>

Android API version: Android API version here

Material Library version: 1.1.0-alpha08 & 1.1.0-alpha09

Device: Galaxy Note 9 (SM-N960F/DS)

To help us triage faster, please check to make sure you are using the latest version of the library.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:6
  • Comments:9 (3 by maintainers)

github_iconTop GitHub Comments

10reactions
jadroacommented, Dec 29, 2019

This is still happening when com.google.android.material.textfield.TextInputLayout used inside viewpager2 based on recyclerview. Its not only inputType number, but for all inputTypes on first focus and when focus change from one TextInputEditText to another TextInputEditText with different inputTypes, then the focus is lost when keyboard shows up.

“com.google.android.material:material:1.2.0-alpha01” “androidx.viewpager2:viewpager2:1.0.0”

2reactions
schlagi123commented, Jan 5, 2021

This issue is a general issue and not specific to the material components. (s. https://github.com/android/views-widgets-samples/issues/107)

If you have a small number of pages there is the workaround to increase the offscreenPageLimit of the ViewPager2 (thanks to @FEvgenSON https://github.com/android/views-widgets-samples/issues/107#issuecomment-726809766)

Read more comments on GitHub >

github_iconTop Results From Across the Web

How can I know when an EditText loses focus? - Stack Overflow
Implement onFocusChange of setOnFocusChangeListener and there's a boolean parameter for hasFocus. When this is false, you've lost focus to ...
Read more >
How can I know when an EditText loses focus in Android?
This example demonstrates how can I know when an EditText loses focus. Step 1 − Create a new project in Android Studio, go...
Read more >
Android – EditText loses focus when keyboard appears
Android – EditText loses focus when keyboard appears; requires touching twice to edit. I have been designing an application which holds an expandable...
Read more >
Android ListView with EditText loses focus when the keyboard ...
The issue is when you have a ListView or an ExpandableListView with input capable fields that displays the soft keyboard on focus, the...
Read more >
How To Use On Focus Change to Format Edit Text on Android ...
If EditText doesn't have decimal point after losing its focus, by default “.00” will be appended to the string. For example, “$50” will...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found