Home > other >  Multiline EditText view hiding behind reyclerview items android
Multiline EditText view hiding behind reyclerview items android

Time:10-27

Hey I used windowSoftInputMode in my android manifest. It working fine in single line text in EditText. I want to do same thing in my multiline text in my EditText.

<activity android:name="XYZActivity"
          android:windowSoftInputMode="adjustPan"/>

Chat.xml

<?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"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@color/white">

    <androidx.recyclerview.widget.RecyclerView
        android:id="@ id/recyclerView"
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:paddingStart="10dp"
        android:paddingEnd="10dp"
        android:paddingBottom="10dp"
        app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
        app:layout_constraintBottom_toTopOf="@ id/guideline"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent"/>

    <androidx.constraintlayout.widget.Guideline
        android:id="@ id/guideline"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:orientation="horizontal"
        app:layout_constraintGuide_percent="0.90" />

    <androidx.constraintlayout.widget.ConstraintLayout
        android:id="@ id/inputContainer"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="@color/grey"
        android:paddingTop="10dp"
        android:paddingBottom="10dp"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@ id/guideline"
        app:layout_constraintVertical_bias="1">

        <EditText
            android:id="@ id/editTextContainer"
            android:layout_width="200dp"
            android:layout_height="match_parent"
            android:fadeScrollbars="false"
            android:inputType="textMultiLine"
            android:scrollbars="vertical"
            app:layout_constraintBottom_toBottomOf="parent"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toTopOf="parent" />

    </androidx.constraintlayout.widget.ConstraintLayout>

</androidx.constraintlayout.widget.ConstraintLayout>

Working in single line text

enter image description here

But it's not working in multiline text

enter image description here

Expected output

enter image description here

CodePudding user response:

You should change the bottom constraint of your recyclerview to

app:layout_constraintBottom_toTopOf="@ id/inputContainer"

The position of the guideline won't change when the inputContainer changes size. It will stay at 90%.

  • Related