3

I am using this code But the keyboard is still overlapping EditText. what can be done

    <android.support.v4.widget.SwipeRefreshLayout
        android:id="@+id/swipeContainer"
        android:layout_below="@+id/optionsBar"
        android:layout_above="@+id/bottomBar"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        >

            <ListView
                android:id="@+id/listView"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:animationCache="false"
                android:divider="@null"
                android:scrollbars="none"
                android:overScrollMode="never"
                android:dividerHeight="0dp"
                android:listSelector="#00000000"
                android:fadingEdge="none"
                android:scrollingCache="false"
                 />

    </android.support.v4.widget.SwipeRefreshLayout>

        <RelativeLayout 
            android:layout_alignParentBottom="true"
            android:layout_width="match_parent"
            android:layout_height="40dp"
            android:id="@+id/bottomBar"
            android:background="@drawable/top_bar_bg"
            >

            <EditText
                android:layout_width="match_parent"
                android:layout_height="30dp"
                android:inputType="text"
                android:paddingLeft="10dp"
                android:paddingRight="43dp"
                android:layout_marginRight="5dp"
                android:layout_centerVertical="true"
                android:maxLines="1"
                android:hint="Your Message"
                android:textColorHint="@android:color/white"
                android:layout_marginLeft="5dp"
                android:textColor="@android:color/white"
                android:textSize="12sp"
                android:id="@+id/chatBox"
                android:background="@drawable/message_type_area"
                 />

            <Button 
                android:gravity="center"
                android:layout_height="23dp"
                android:layout_width="37dp"
                android:contentDescription="@null"
                android:background="@drawable/send_btn"
                android:layout_centerVertical="true"
                android:layout_alignParentRight="true"
                android:layout_marginRight="5dp"
                android:id="@+id/sendBtn"/>

        </RelativeLayout>

</RelativeLayout>

 <activity
            android:name=".ChatActivity"
            android:windowSoftInputMode="adjustPan"
            android:screenOrientation="portrait" >
        </activity>

enter image description here

Muhammad Umar
  • 11,391
  • 21
  • 91
  • 193

4 Answers4

1

adjustResize fails to work when you use a FullScreenActivity. One solution would be to contain the whole layout in a ScrollView and scroll it to position editText.getY() + editText.getMeasuredHeight() when the editText gains focus.

Or, if you want a quick fix to the problem, have at look at this solution on a similar question here.

Community
  • 1
  • 1
Swayam
  • 16,294
  • 14
  • 64
  • 102
0

The property android:windowSoftInputMode="adjustResize" doesn't work with full screen activity, you have to remove activity full screen flags in order to get advantage of adjust resize.

see this: A fullscreen window will ignore a value of SOFT_INPUT_ADJUST_RESIZE for the window's softInputMode field; the window will stay fullscreen and will not resize.

Ashlesha Sharma
  • 949
  • 7
  • 15
0

android:maxLines="1" in your xml file and use in mainfiest file.

        <activity
        android:name="Logintab"

        android:windowSoftInputMode="adjustPan"
        android:label="@string/app_name"></activity>
android_jain
  • 788
  • 8
  • 19