I'm wondering if anyone else has experienced this strange bug. My layout is complicated but essentially it's rows of view holders with EditText fields.
It worked flawlessly until I updated my target SDK to API 30.
After targetting API 30, some of my EditText fields don't respond to "focus touch events" (the cursor handle doesn't show up, you can't long press, and you can't select any text). You can still type in the field and move the cursor by tapping. Again, some text fields work perfectly fine while others are affected by this bug.
^ The image is not of my app, just to show the cursor handler for understanding.
<!-- in constraint layout -->
<androidx.appcompat.widget.AppCompatEditText
android:id="@+id/myTextField"
android:layout_height="wrap_content"
android:layout_width="0dp"
app:layout_constraintHorizontal_weight="1"
app:layout_constraintLeft_toRightOf="parent"
app:layout_constraintRight_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"/>
<!-- in linear layout -->
<androidx.appcompat.widget.AppCompatEditText
android:id="@+id/myTextField"
android:layout_height="wrap_content"
android:layout_width="0dp"
android:layout_weight="1"/>
If I change the text fields width to wrap_content
it works perfectly for all text fields, but that doesn't fit with my design. I need the text field to fill the available space.
I even tried manually setting the width to a random dp value and it still didn't work.
I've tested on < API 30 devices and it's totally fine.
Did I miss something? Why isn't this working on API 30+?
Is there another way to get the EditText field to fill the space?
from Android some EditText fields don't respond to long-press (API 30+ with layout_width 0dp)
No comments:
Post a Comment