Android Keyboard not pushing layout up

187 Views Asked by At

My keyboard is not popping up the edittext to enter text. I tried setting adjustSize in windowSoftInputMode in my android manifest.

Here is my AndroidManifest.xml

 <activity
   android:windowSoftInputMode="adjustResize"
   android:name=".MainActivity">
      <intent-filter> 
           <action android:name="android.intent.action.MAIN" />
           <category android:name="android.intent.category.LAUNCHER" />
      </intent-filter>
  </activity>

I have only one editText

<EditText
   android:layout_width="0dp"
   android:layout_height="48dp"
   android:layout_marginLeft="8dp"
   android:layout_weight="1"
   android:background="@drawable/edittext_background"
   android:hint="@string/message_hint"
   android:textColorHint="@android:color/darker_gray"
   android:textStyle="bold" />

Here is my entire layout.

<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="@android:color/white"
    android:fitsSystemWindows="true"
    tools:context=".MainActivity">

    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent">
        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_marginBottom="80dp"
            android:orientation="vertical"
            android:padding="10dp">

            <android.support.v7.widget.RecyclerView
                android:id="@+id/chatList"
                android:layout_width="match_parent"
                android:layout_height="wrap_content" />
        </LinearLayout>

        <RelativeLayout
            android:id="@+id/appbarlayout"
            android:layout_width="match_parent"
            android:layout_height="80dp"
            android:layout_alignParentTop="true">

            <android.support.v7.widget.Toolbar
                android:id="@+id/toolbar"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginTop="24dp"
                android:elevation="4dp"
                android:minHeight="?attr/actionBarSize" />

        </RelativeLayout>


        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_alignParentBottom="true"
            android:background="@android:color/white"
            android:gravity="center_vertical"
            android:padding="16dp">

            <ImageView
                android:layout_width="40dp"
                android:layout_height="40dp"
                android:background="@drawable/button_gradient"
                android:src="@drawable/add" />

            <EditText
                android:layout_width="0dp"
                android:layout_height="48dp"
                android:layout_marginLeft="8dp"
                android:layout_weight="1"
                android:background="@drawable/edittext_background"
                android:hint="@string/message_hint"
                android:textColorHint="@android:color/darker_gray"
                android:textStyle="bold" />

            <ImageView
                android:layout_width="33dp"
                android:layout_height="33dp"
                android:layout_marginLeft="10dp"
                android:layout_marginRight="10dp"
                android:src="@drawable/mic" />

            <ImageView
                android:layout_width="40dp"
                android:layout_height="40dp"
                android:src="@drawable/camera" />

        </LinearLayout>

    </RelativeLayout>
</RelativeLayout>

I tried with all other options of windowSoftInputMode both from AndroidManifest and Programatically, but not working. I tried using ScrollView as root layout too. But was still not working.

0

There are 0 best solutions below