TextInputEditText losing focus
See original GitHub issueDescription: 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:
- Created 4 years ago
- Reactions:6
- Comments:9 (3 by maintainers)
Top GitHub Comments
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”
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 theViewPager2
(thanks to @FEvgenSON https://github.com/android/views-widgets-samples/issues/107#issuecomment-726809766)