I have two buttons and an EditText. When the keyboard is open, I want the EditText to resize and only one of the two buttons to be above the keyboard.
What I tried was:
<activity
android:name=".activities.MyActivity"
android:exported="false"
android:windowSoftInputMode="stateVisible|adjustResize"/>
However, this moves both buttons above the keyboard, not only one.
Expected when the keyboard is closed
Expected when the keyboard is opened
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="0dp"
app:title="Motivation Setting"
android:layout_height="56dp"
android:background="?attr/colorPrimary"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintLeft_toLeftOf="parent"/>
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/textInputLayout"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
android:layout_marginTop="8dp"
app:counterEnabled="true"
app:hintEnabled="true"
app:layout_constraintBottom_toTopOf="@id/previewButton"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/toolbar">
<EditText
android:id="@+id/motivationEditText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:autofillHints="Motivation Text"
android:focusable="true"
android:focusableInTouchMode="true"
android:gravity="start|top"
android:hint="@string/text_reminder"
android:inputType="textCapSentences|textMultiLine"
android:minLines="10"
android:overScrollMode="always"
android:scrollbarStyle="insideInset"
android:scrollbars="vertical"
android:textColorHint="#616161" />
</com.google.android.material.textfield.TextInputLayout>
<Button
android:id="@+id/previewButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="16dp"
android:text="@string/preview"
app:layout_constraintBottom_toTopOf="@id/submitRequest"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" />
<Button
android:id="@+id/submitRequest"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="16dp"
android:text="@string/submitRequest"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>