I have the following .xml
file:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/main_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/grey_100"
android:orientation="vertical"
android:weightSum="4">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="3"
android:gravity="center_horizontal"
android:orientation="vertical">
<ImageView
android:id="@+id/login_logo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/welcome_bottom_margin"
android:layout_marginTop="@dimen/login_logo_margin_top"
android:theme="@style/ThemeOverlay.MyTitleText"
app:srcCompat="@mipmap/ic_launcher" />
<TextView
android:id="@+id/status"
style="@style/ThemeOverlay.MyTextDetail"
android:text="@string/signed_out" />
</LinearLayout>
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:background="@color/grey_300"
android:gravity="center_vertical">
<LinearLayout
android:id="@+id/email_password_fields"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:paddingLeft="16dp"
android:focusable="true"
android:focusableInTouchMode="true"
android:paddingRight="16dp">
<EditText
android:id="@+id/field_email"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:hint="@string/hint_email"
android:inputType="textEmailAddress" />
<EditText
android:id="@+id/field_password"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:hint="@string/hint_password"
android:inputType="textPassword" />
</LinearLayout>
<LinearLayout
android:id="@+id/email_password_buttons"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/email_password_fields"
android:orientation="horizontal"
android:paddingLeft="16dp"
android:paddingRight="16dp">
<Button
android:id="@+id/email_sign_in_button"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="@string/sign_in"
android:theme="@style/ThemeOverlay.MyDarkButton" />
<Button
android:id="@+id/email_create_account_button"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="@string/create_account"
android:theme="@style/ThemeOverlay.MyDarkButton" />
</LinearLayout>
</RelativeLayout>
</LinearLayout>
That looks like this. But when I open my keyboard it hides 80% of the RelativeLayout
.
How may I move the layout above the keyboard?
I have found a diversity of answers but none of them seem to work.
EDIT:
Even after adding android:windowSoftInputMode="adjustResize"
in my Manifest
like such:
<activity android:name=".MainActivity"
android:windowSoftInputMode="adjustResize" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
</intent-filter>
</activity>`
I get the following outcome:
.