0

My xml file like below its for chat activity someone open the keyboard how can I make content up with keyboard without changing toolbar

<?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="@color/white"
    tools:context="com.example.crowderia.chat.ChatActivity">

    <include
        layout="@layout/toolbar_chat"
        android:id="@+id/chat_page_toolbar">
    </include>

    <android.support.v7.widget.RecyclerView
        android:id="@+id/messages_list"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_alignParentStart="true"
        android:layout_below="@+id/chat_page_toolbar"
        android:layout_above="@id/linearLayout">

    </android.support.v7.widget.RecyclerView>

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:paddingLeft="10dp"
        android:paddingEnd="10dp"
        android:layout_marginBottom="52dp"
        android:id="@+id/linearLayout">

        <EditText
            android:id="@+id/et_send_message"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:hint="Send a chat"
            android:inputType="text"
            android:textColor="@color/dark_grey"
            android:imeOptions="actionSend"/>

    </LinearLayout>

</RelativeLayout>

when I open the keyboard nothing changing all the things like fixed so I cant even see what am I typing How can I fix this

HemalHerath
  • 1,006
  • 2
  • 18
  • 38

1 Answers1

0

Try this add android:windowSoftInputMode="adjustPan" in your activity of manifest file like this

<activity
    android:name=".YourActivity"
    android:windowSoftInputMode="adjustResize" />

and add NestedScrollView as parent of Your layout so you can scroll while keyboard is open

 <?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout 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"
    tools:context="com.ncrypted.bistrostays.activity.ReferralsActivity">

    <android.support.design.widget.AppBarLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">

        <include
            android:id="@+id/chat_page_toolbar"
            layout="@layout/toolbar_chat"></include>

    </android.support.design.widget.AppBarLayout>

    <android.support.v4.widget.NestedScrollView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        app:layout_behavior="@string/appbar_scrolling_view_behavior">


        <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="@color/white"
            tools:context="com.example.crowderia.chat.ChatActivity">


            <android.support.v7.widget.RecyclerView
                android:id="@+id/messages_list"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:layout_above="@id/linearLayout"
                android:layout_alignParentStart="true"
                android:layout_below="@+id/chat_page_toolbar"
                android:nestedScrollingEnabled="false">

            </android.support.v7.widget.RecyclerView>

            <LinearLayout
                android:id="@+id/linearLayout"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_alignParentBottom="true"
                android:layout_marginBottom="52dp"
                android:paddingEnd="10dp"
                android:paddingLeft="10dp">

                <EditText
                    android:id="@+id/et_send_message"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:hint="Send a chat"
                    android:imeOptions="actionSend"
                    android:inputType="text"
                    android:textColor="@color/dark_grey" />

            </LinearLayout>

        </RelativeLayout>
    </android.support.v4.widget.NestedScrollView>
</android.support.design.widget.CoordinatorLayout>
Goku
  • 9,102
  • 8
  • 50
  • 81