In my Android activity, I have an EditText with other layouts before and after. When I click in the EditText, the soft keyboard is open and the view is scrolled just enough so that I can see the cursor.
This seems to be the default behavior.
But I would like that the EditText is FULLY visible (I have a border around it).
How can I do that?
My current code:
manifest.xml:
<activity
android:name=".MainActivity"
android:windowSoftInputMode="adjustPan"
...
layout:
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<LinearLayout
android:id="@+id/linear1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:minHeight="300dp"
android:background="#bbbbbb"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<androidx.appcompat.widget.AppCompatEditText
android:id="@+id/notes"
android:layout_height="wrap_content"
android:layout_width="match_parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/linear1"
android:background="@drawable/border"
android:layout_margin="8dp"
android:imeOptions="actionDone"
android:minLines="10"
android:inputType="textMultiLine"
android:selectAllOnFocus="true"/>
<LinearLayout
android:id="@+id/linear2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:orientation="vertical"
android:minHeight="50dp"
android:background="#bbbbbb"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/notes"/>
</androidx.constraintlayout.widget.ConstraintLayout>
With closed keyboard:
With open keyboard (current behavior): the EditText is truncated
Expected behavior:




set your activity windowSoftInput mode to adjustResize in manifest.xml
then wrap your content with a scrollview
Update: this works for me