I have a RecyclerView and an EditText inside a CardView . Purpose of the activity is to chat. So the RecyclerView contains all the messages sent and received, and the CardView is where the user types the messages. Coming to the problem, I need to move the contents up when the Keyboard pops up. Now, this doesn't seems to be a simple problem.
I tried all these Questions:
- Push up content when clicking in edit text
- How to move the layout up when the soft keyboard is shown android
- Move layouts up when soft keyboard is shown?
And, the solution to most comes down to altering android:windowSoftInputMode . Which I tried, switching to adjustPan and adjustResize. Here is the code to my Activity:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#F0F0F0"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:paddingStart="10dp"
android:paddingEnd="10dp"
tools:context="com.devpost.airway.MainActivity">
<android.support.v7.widget.RecyclerView
android:id="@+id/chatView"
android:layout_width="match_parent"
android:layout_height="match_parent">
</android.support.v7.widget.RecyclerView>
<android.support.v7.widget.CardView
android:layout_alignParentBottom="true"
android:layout_marginTop="10dp"
app:cardElevation="0dp"
app:cardCornerRadius="10dp"
android:layout_marginBottom="10dp"
android:layout_width="match_parent"
android:layout_height="50dp">
<EditText
android:id="@+id/chat_input"
android:paddingStart="2dp"
android:paddingEnd="2dp"
android:inputType="text"
android:imeOptions="actionSend"
android:background="@null"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</android.support.v7.widget.CardView>
</RelativeLayout>
And adjustPan does work in a very vague way, I've added the screenshot below, kindly take a look :
IMAGE-1
IMAGE-2
Now, clearly from Image-1 and Image-2, there are few issues:
- The
ActionBaris moved up . - When Keyboard pops up it adds a transition animation
- It pushes the entire RecyclerView up
So, the question is:
Is it manually possible to override any methods and implement things myself up, other than allowing the android:windowSoftInputMode to change the way it prefers? Kindly help.

