The question is already asked here. But don't have satisfactory answer, so I am asking again.
I have a scrollable user registration form, and a fixed SignUp button at the bottom of the screen. And i need to show SignUp button at bottom only i.e. It shouldn't be scrollable. I am using RelativeLayout as root container.
My View Hierarchy is:
In case of android:windowSoftInputMode="adjustNothing"
When i tap in any of my EditText then the soft keyboard appears but scrollview is not completely scrollable. Space equivalent to keyboard is gone behind the keyboard. Which i want to make scrollable.
In case of android:windowSoftInputMode="adjustPan"
It works a bit better but not exactly the way i want it. It pushes my whole screen upward including toolbar which is not desired.
In case of android:windowSoftInputMode="adjustResize"
It pushes my button upward which is not required at all.
So, please suggest me a solution which i can use to fulfil my requirement.
Here is my xml code:
<?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"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/black"
tools:context=".activities.CreateAccountActivity">
<include
android:id="@+id/toolbar"
layout="@layout/app_toolbar" />
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@+id/toolbar"
android:fillViewport="true"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"><!--android:paddingBottom="@dimen/activity_vertical_margin"-->
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:id="@+id/ll_fields"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<EditText
android:id="@+id/et_first_name"
style="@style/create_account_edittext"
android:hint="@string/first_name" />
<EditText
android:id="@+id/et_last_name"
style="@style/create_account_edittext"
android:hint="@string/last_name" />
<EditText
android:id="@+id/et_dob"
style="@style/create_account_edittext"
android:hint="@string/date_of_birth" />
<EditText
android:id="@+id/et_email"
style="@style/create_account_edittext"
android:hint="@string/email"
android:inputType="textEmailAddress" />
<EditText
android:id="@+id/et_password"
style="@style/create_account_edittext"
android:hint="@string/password"
android:inputType="textPassword" />
<EditText
android:id="@+id/et_confirm_password"
style="@style/create_account_edittext"
android:hint="@string/confirm_password"
android:inputType="textPassword" />
<LinearLayout
android:id="@+id/ll_terms"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/separator_margin"
android:background="@color/et_create_account_bg"
android:orientation="horizontal"
android:padding="10dp">
<CheckBox
android:id="@+id/cb_terms"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:theme="@style/BrandedCheckbox" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="start"
android:text="@string/accept_terms"
android:textColor="@color/white"
app:font="@string/font_helvetica_normal" />
</LinearLayout>
<LinearLayout
android:id="@+id/ll_subscription"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/et_create_account_bg"
android:orientation="horizontal"
android:padding="10dp">
<CheckBox
android:id="@+id/cb_subscription"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:theme="@style/BrandedCheckbox" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="start"
android:gravity="center_vertical"
android:text="@string/subscription_details"
android:textColor="@color/white"
app:font="@string/font_helvetica_normal" />
</LinearLayout>
</LinearLayout>
<Button
android:id="@+id/btn_create_account"
style="@style/buttonStyle"
android:layout_alignParentBottom="true"
android:text="@string/create_account" />
</RelativeLayout>
</ScrollView>
And my manifest is:
<activity
android:name=".activities.CreateAccountActivity"
android:screenOrientation="portrait"
android:theme="@style/AppTheme.NoActionBar" />