In my layout I have an edit text and an image view. The image view height is set to match parent layout.
What I want to happen is, when the user selects the edit text and the keyboard appears, the edit text should be above the keyboard whilst the image view should stay in the exact position as it was before the keyboard appeared. Right now the whole layout is pushed up but I want the image view to not move.
I have tried using adjustPan, adjustResize, adjustNothing but they don't achieve what I want.
Before keyboard. I need this image to be exactly where it is once the keyboard appears.
But the image moves up which is not what I want. Basically I need the keyboard to overlap the image.
Here is my xml 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"
android:background="@android:color/black">
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/image_view"
android:scaleType="fitCenter"/>
<View
android:layout_width="match_parent"
android:layout_height="0dp"
android:id="@+id/transparent_view"
android:background="@android:color/black"
android:alpha="0.6"
app:layout_constraintTop_toTopOf="@id/message_edit_text"
app:layout_constraintBottom_toBottomOf="parent"/>
<ImageView
android:layout_width="0dp"
android:layout_height="0dp"
android:id="@+id/gallery_icon"
app:layout_constraintDimensionRatio="1:1"
tools:src="@drawable/gallery_icon"
android:padding="10dp"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintBottom_toBottomOf="@id/message_edit_text"
app:layout_constraintTop_toTopOf="@id/message_edit_text"/>
<EditText
android:layout_width="0dp"
android:layout_height="wrap_content"
android:id="@+id/message_edit_text"
android:hint="Type a message..."
android:layout_marginBottom="10dp"
android:padding="10dp"
android:textColor="@color/white"
android:maxLines="5"
android:textColorHint="@android:color/darker_gray"
android:background="@null"
app:layout_constraintLeft_toRightOf="@+id/gallery_icon"
app:layout_constraintRight_toLeftOf="@id/send_button"
app:layout_constraintBottom_toBottomOf="parent"/>
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/send_button"
android:layout_marginBottom="12dp"
android:layout_marginRight="12dp"
android:clickable="true"
android:visibility="visible"
android:backgroundTint="@color/green"
app:borderWidth="0dp"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="@id/transparent_view"
app:layout_constraintBottom_toTopOf="@id/transparent_view"/>
</androidx.constraintlayout.widget.ConstraintLayout>