0

I have the following code that is inside a ScrollView and the SoftInput.AdjustResize setting, but when the keyboard is shown, it hides half of the EditText. Also, when a new line is added, all the rows above the cursor are shown.

<EditText
    android:layout_height="wrap_content"
    android:layout_width="match_parent"
    android:inputType="textMultiLine"
    android:isScrollContainer="true"
    android:gravity="top"
    android:minHeight="10dp"
    android:maxLines="6"
    android:minLines="2"
    android:cursorVisible="true"/>

Do you know a way in which I can have the whole EditText displayed?

Also, an implementation without the ScrollView and with SoftInput.AdjustPan was tested, and the result is the same.

MihaiBC
  • 472
  • 5
  • 15
  • https://stackoverflow.com/questions/27858987/positioning-edittext-above-keyboard – Usama Altaf Feb 19 '21 at 12:00
  • as stated in the description, I already tried the AdjustPan option. It works ok for single line EditText but with multiline not. – MihaiBC Feb 19 '21 at 12:02
  • try to use `android:imeOptions="flagNoExtractUi"` in edittext – Usama Altaf Feb 19 '21 at 12:04
  • It does not work, the displayed part is just the first row. It seems that the system behaves differently on the multiline. – MihaiBC Feb 19 '21 at 12:16
  • @UsamaAltaf workaround that worked was to set gravity bottom and that way the cursor will be on the second row and the entire EditText is visible. Thank you for the help. – MihaiBC Feb 19 '21 at 12:25

1 Answers1

0

A workaround fix is to set gravity bottom and that way the cursor will be on the second row and the entire EditText is visible.

MihaiBC
  • 472
  • 5
  • 15