Edittext should move up the keyboard without moving other views
[This is the image to be moved up, only the edittext, not the logo] [1] edittext that appears at the top of the keyboard after setting windowSoftInputMode, but other views also move up. this is their way of moving only the edittext. thanks in advance
[1]: https://i.stack.imgur.com/NEpf3.png `
<ScrollView
android:id="@+id/scroll"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:orientation="vertical">
<LinearLayout
android:id="@+id/linear"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="50dp"
android:src="@drawable/logo_light"
android:text="LOGO"
android:textColor="@color/black"
android:textSize="100dp" />
</LinearLayout>
</ScrollView>
<LinearLayout
android:id="@+id/ll_send_message"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_marginBottom="50dp"
android:orientation="horizontal">
<EditText
android:id="@+id/editMessage"
android:layout_width="0dp"
android:layout_height="fill_parent"
android:layout_gravity="center_vertical|center_horizontal"
android:layout_weight="5"
android:background="@color/white"
android:gravity="center"
android:inputType="textMultiLine|textCapSentences"
android:maxLines="5"
android:hint="EDIT TEXT"
android:minLines="3"
android:textColorHint="@color/black"
android:scrollHorizontally="false"
android:textColor="@color/white" />
<Button
android:id="@+id/buttonSend"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical|center_horizontal"
android:background="@color/black"
android:gravity="center"
android:text="send"
android:textAppearance="?android:attr/textAppearanceMedium" />
</LinearLayout>
`
+3
source to share
2 answers
Try using framlayout and xml like below
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<EditText
android:id="@+id/edit_text_message"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom|center_vertical"
android:layout_marginLeft="12dp"
android:background="@null"
android:layout_alignParentBottom="true"
android:hint="Enter you something"
android:inputType="textCapSentences|textMultiLine"
android:maxLength="2000"
android:maxLines="8" />
</FrameLayout>
+1
source to share