So I have a EditText
on the bottom of the screen for user input and when I click on it, the keyboard pops up and it shifts it up but the issue is how it is being shifted. Rather than moving the EditText
with the keyboard, the keyboard will show and half a second later, the EditText
gets snapped into place. And when I close the keyboard, the EditText
remains the extended size for half a second before going back to the original size.
The question is, is it possible for a smooth transition?
Not sure if this will affect the outcome but it is within a Fragment
.
<?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="fill_parent"
android:layout_height="fill_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:backgroundTint="#c1c1c1">
<ListView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@+id/ListViewChat"
android:layout_alignParentLeft="false"
android:layout_alignParentStart="false"
android:dividerHeight="1dp"
android:layout_alignParentRight="false"
android:layout_alignParentEnd="false"
android:layout_below="@+id/tabs"
android:layout_above="@+id/relativeLayout4" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@android:color/transparent"
android:id="@+id/relativeLayout4"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true">
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/editTextMessage"
android:hint="Enter a message..."
android:background="@android:color/transparent"
android:layout_alignBottom="@+id/buttonSend"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:layout_toLeftOf="@+id/buttonSend"
android:layout_toStartOf="@+id/buttonSend"
android:layout_marginLeft="20dp"
android:layout_marginTop="10dp"
android:layout_marginBottom="10dp"
android:maxLength="120"
android:singleLine="true"/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Send"
android:id="@+id/buttonSend"
android:layout_alignParentTop="true"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:background="@null" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/imageView5"
android:src="@drawable/linebreak2px"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" />
</RelativeLayout>
</RelativeLayout>
Try setting
android:windowSoftInputMode="adjustResize"
inside your AndroidManifest.xml, inside your activity, let me know if it works
Try the below in your AndroidManifest.xml where your acivity is declared in which you have the fragment that your are working
android:windowSoftInputMode="adjustPan"
and let me know if it works
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.