I have to use a scroll view for the form data and a button that should be at the bottom of the screen. I have achieved it. but the problem is whenever the EditText gets focused and the keyboard is opened the button does not stay at the bottom of the screen it comes just above the android keyboard. I want it to be there at the bottom even when the keyboard is opened or not.
I have tried the android:fillViewport="true"
with scroll view but it does not give a proper output.
<?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:id="@+id/lout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true">
<LinearLayout
android:id="@+id/fout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingBottom="16dp"
android:paddingTop="10dp">
<ImageView
android:id="@+id/fimg"
android:layout_width="match_parent"
android:layout_height="250dp"
android:src="@drawable/addimg" />
<android.support.design.widget.TextInputLayout
android:id="@+id/vsubcusine"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingBottom="10dp"
android:paddingLeft="5dp"
android:paddingRight="5dp"
android:paddingTop="10dp"
>
<EditText
android:id="@+id/add_food_title"
style="@style/textbox"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Title for Food"
android:inputType="text"
/>
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:id="@+id/vcusine"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="cusine"
android:paddingBottom="10dp"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:paddingTop="0dp">
<Spinner
android:id="@+id/cusine"
style="@style/textbox"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#fff"
android:padding="10dp" />
</android.support.design.widget.TextInputLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:paddingBottom="10dp"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:paddingTop="10dp">
<RadioGroup
android:id="@+id/isveg"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:paddingLeft="20dp">
<RadioButton
android:id="@+id/veg"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="2"
android:text="Veg" />
<RadioButton
android:id="@+id/nonveg"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="2"
android:text="Non-Veg" />
</RadioGroup>
</LinearLayout>
<android.support.design.widget.TextInputLayout
android:id="@+id/vfprice"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingBottom="0dp"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:paddingTop="0dp"
>
<EditText
android:id="@+id/fprice"
style="@style/textbox"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:hint="price"
android:inputType="number" />
</android.support.design.widget.TextInputLayout>
</LinearLayout>
</ScrollView>
<LinearLayout
android:id="@+id/t"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:gravity="center"
android:orientation="horizontal"
android:weightSum="2">
<Button
android:id="@+id/foodadd"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:layout_weight="1"
android:background="@drawable/button"
android:text="ADD FOOD"
android:textColor="#FFF"
android:textStyle="bold" />
</LinearLayout>
</RelativeLayout>