0

I hava a long TextInputEditText in a TextInputLayout in a ScrollView, When I click at the start of the text to set the cursor position on the first line, but suddenly screen scrolls to bottom. see GIF below:

bug: scroll suddenly



Now if I remove Material box style from TextInputLayout, everything is ok. No sudden scroll on first line click.

<com.google.android.material.textfield.TextInputLayout
            android:id="@+id/tilDescription"
            <!--style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.Dense"-->
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="40dp"
            android:hint="Product Description"
            app:counterEnabled="true"

see this GIF, when I remove style attribute:

no sudden scroll here: https://i.stack.imgur.com/55nZa.gif



What's wrong with outlined Box style?
Caution: I don't want to change windowSoftInputMode in AndroidManifest to adjustPan, I should use adjustResize because I have some other stuff which keyboard shouldn't appear on top of them.

Mneckoee
  • 2,802
  • 6
  • 23
  • 34

1 Answers1

1

For multi-line TextInputEditTexts that might be taller than the screen (especially after the soft keyboard is shown), you need to add the following to your TextInputEditText

app:textInputLayoutFocusedRectEnabled="false"

as described here: Android TextInputLayout writing focus issue when height is bigger than the screen

Larq
  • 36
  • 1