I am very new to using ConstraintLayout. In trying to learn to use this, I decided to make a simple chat app for myself.
I have a RecyclerView to show chat list and a ConstraintLayout under it for typing in my message (my code is at the bottom). I would very much want to use "fill-parent" attribute but I found that it's deprecated.
So I have set my RecyclerView to be constrained at the bottom by the ConstraintLayout below it. From this I am expecting the RecyclerView to "shrink" when the keyboard comes up to type my message in. However, it is not doing so, but rather stays at its full height.
Are there ways to resolve this?
Here's my code :
<android.support.constraint.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:paddingTop="10dp"
android:paddingBottom="10dp"
android:paddingLeft="5dp"
android:paddingRight="5dp"
tools:context=".StreamPlayer.StreamPlayerActivity">
<android.support.v7.widget.RecyclerView
android:id="@id/ChatRecyclerView"
android:layout_width="match_parent"
android:layout_height="0dp"
android:scrollbars="vertical"
app:layout_constraintBottom_toTopOf="@id/ChatTypingLayout"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:listitem="@layout/chat_layout" /
<android.support.constraint.ConstraintLayout
android:id="@id/ChatTypingLayout"
android:layout_width="match_parent"
android:layout_height="40dp"
android:orientation="horizontal"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent">
<EditText
android:id="@id/ChatNameEditText"
android:layout_width="0dp"
android:layout_height="match_parent"
android:hint="@string/ChatNameEditText"
android:inputType="text"
android:maxLines="1"
app:layout_constraintHorizontal_weight="1"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toLeftOf="@id/ChatMessageEditText"
app:layout_constraintStart_toStartOf="parent"
android:textSize="10dp"/>
<EditText
android:id="@id/ChatMessageEditText"
android:layout_width="0dp"
android:layout_height="match_parent"
android:hint="@string/ChatMessageEditText"
android:inputType="textLongMessage"
android:maxLines="3"
app:layout_constraintHorizontal_weight="4"
app:layout_constraintLeft_toRightOf="@id/ChatNameEditText"
app:layout_constraintRight_toLeftOf="@id/ChatSendButton"
android:textSize="10dp"/>
<Button
android:id="@id/ChatSendButton"
android:layout_width="0dp"
android:layout_height="match_parent"
android:text="@string/ChatSendButton"
app:layout_constraintHorizontal_weight="2"
app:layout_constraintLeft_toRightOf="@id/ChatMessageEditText"
app:layout_constraintRight_toRightOf="parent"/>
</android.support.constraint.ConstraintLayout>
</android.support.constraint.ConstraintLayout>
This is when the keyboard has not come up
This happens when the keyboard comes up
Thanks in advance