Reputation: 1051
I have the button on the bottom on a RelativeLayout but on the page there are editTexts and when those are active the keyboard pops up and the button doesn't stay on the bottom it moves to above the keyboard. This button is for sending a finished filled in form so I can't have the button moving above the keyboard when it's activated.
This is the layout right now
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout 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"
android:background="@color/lightGray"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:id="@+id/ind_survey_title"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="asdfasdfds group"
android:textColor="@color/mediumBlue"
android:textSize="20sp"
app:layout_constrainedWidth="true"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintWidth_percent="0.75" />
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal"
app:layout_constrainedWidth="true"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintWidth_percent="0.25">
<ImageView
android:id="@+id/ind_survey_anonymous_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:scaleX="0.8"
android:scaleY="0.8"
android:src="@drawable/ic_x" />
<TextView
android:id="@+id/ind_survey_anonymous"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/anonymous"
android:textColor="@color/red"
android:textSize="14sp" />
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
<TextView
android:id="@+id/ind_survey_desc"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/D5dp"
android:paddingStart="@dimen/D20dp"
android:paddingEnd="@dimen/D5dp"
android:text=""
android:textColor="@android:color/black"
android:textSize="14sp" />
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="@color/mediumGray" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/reclycer_view_survey_questions"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/lightGray" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:gravity="end"
android:orientation="vertical">
<Button
android:id="@+id/sendbtn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/login_button"
android:minHeight="0dp"
android:text="@string/send_survey"
android:textAllCaps="false"
android:textColor="@android:color/white"
android:textSize="14sp" />
</LinearLayout>
</RelativeLayout>
How can I make sure the button doesn't move when the keyboard is active?
Upvotes: 0
Views: 35
Reputation: 53
Try turning the root layout into scrollview and relative layout as the immediate child
Upvotes: 0
Reputation: 2710
Make use of this:
android:windowSoftInputMode="adjustNothing"
To avoid your Views to be adjusted as per the keyboard moment.
Add this line within your Activity Tag in the Manifest file.
Upvotes: 1