1

I'm trying to create an Android app at the moment. Right now I'm doing some fiddling with EditTexts, and I happened to notice that when I click on the EditText, it drops below the keyboard. When I click on the keyboard, I notice the EditText and the button drop to an area below where the keyboard would obstruct it.

Here's my layout:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:gravity="center_horizontal"
    android:orientation="vertical"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    tools:context="me.flipbook.android.LoginActivity" >

    <!-- Login progress -->

    <ProgressBar
        android:id="@+id/login_progress"
        style="?android:attr/progressBarStyleLarge"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginBottom="8dp"
        android:visibility="gone" />

    <TextView
        android:id="@+id/flipbookText"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center_horizontal"
        android:layout_marginBottom="36dp"
        android:drawableLeft="@drawable/flipbook_logo"
        android:drawablePadding="16dp"
        android:fitsSystemWindows="true"
        android:text="Flipbook"
        android:textAppearance="?android:attr/textAppearanceLarge"
        android:textColor="#FFFFFF"
        android:textSize="48dp"
        android:textStyle="bold" />

    <ScrollView
        android:id="@+id/login_form"
        android:layout_width="match_parent"
        android:layout_height="match_parent" >

        <LinearLayout
            android:id="@+id/email_login_form"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical" >

            <AutoCompleteTextView
                android:id="@+id/email"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:hint="@string/prompt_email"
                android:inputType="textEmailAddress"
                android:maxLines="1"
                android:singleLine="true" />

            <EditText
                android:id="@+id/password"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginTop="8dp"
                android:hint="@string/prompt_password"
                android:imeActionId="@+id/login"
                android:imeActionLabel="@string/action_sign_in_short"
                android:imeOptions="actionUnspecified"
                android:inputType="textPassword"
                android:maxLines="1"
                android:singleLine="true" />

            <Button
                android:id="@+id/email_sign_in_button"
                style="?android:textAppearanceSmall"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginTop="16dp"
                android:text="@string/action_sign_in"
                android:textColor="#f70"
                android:textStyle="bold" />
        </LinearLayout>
    </ScrollView>

</LinearLayout>

Before After

adneal
  • 30,484
  • 10
  • 122
  • 151
beechboy2000
  • 151
  • 6

1 Answers1

1

By changing <activity android:windowSoftInputMode="adjustResize"/> to adjustPan as mentioned here, I was able to fix my issue.

Community
  • 1
  • 1
beechboy2000
  • 151
  • 6