CardView Scroll up keyboard behavior

The main content of our application is RecylerView CardView. To register, we need more than just a username / password to create an account, so we decided to create a registration stream from CardView in accordance with the user's experience after registration.

To do this, I have one action that animates the fragments at the bottom and the existing fragments at the top to imitate the scroll. This fake scrolling occurs when the user enters data and gets near them. This works pretty well, with one exception. When we have an EditText for input, the keyboard comes up and closes the “next” button at the bottom of the screen.

In our user testing, we noticed a high percentage of users trying to scroll the map to go to the next button, instead of rejecting the keyboard.

I spent a lot of time unsuccessfully trying to get CardView to scroll up to open the button, and I have no ideas or searching for new ones.

In the registration activity layout, there is only FrameLayout into which I load fragments. Each loaded fragment has a CardView for the root layout.

In the manifest, I set the windowsSoftInputMode action to configure Resize, adjustPan with little success.

activity_signup.xml

<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/signUpContent"
android:layout_width="match_parent"
android:layout_height="match_parent"/>

simplified fragment_enter_code.xml

<android.support.v7.widget.CardView
style="@style/CardViewStyle.SignUp"
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="wrap_content"
app:cardCornerRadius="25dp"
app:cardElevation="2dp"
app:cardUseCompatPadding="true"
app:contentPadding="8dp">

        <EditText
             android:id="@+id/codeEditText"
             style="@style/HintedEditText"
             android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:hint="Code"
             android:inputType="text"/>

        <Button
            style="@style/NextButton"
            android:id="@+id/nextButton"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:enabled="false"
            android:text="@string/next"/>

</android.support.v7.widget.CardView>

When I tried to put the CardView in ScrollView into the map layout (with fillViewport true), I get a scroll bar, but the map does not scroll, and the map layout is not confused.

- WindowSoftInputMode , ? CardView , ?

, , .

+4
1

, , , , CardView, ScrollView, , SoftInputMode adjustResize, .

<ScrollView><CardView><content...></CardView></ScrollView>, CardView _parent. , fillViewPort = "true" ScrollView, , .

, , FrameLayout ( ) CardView ScrollView.

, , , CardView.

<ScrollView
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="wrap_content"
    android:layout_height="match_parent"
    android:fillViewport="true">

    <FrameLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content">

        <android.support.v7.widget.CardView
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            app:cardCornerRadius="35dp"
            app:cardElevation="2dp"
            app:cardUseCompatPadding="true"
            app:contentPadding="8dp">

            <RelativeLayout
                android:layout_width="match_parent"
                android:layout_height="match_parent">

                <ImageView
                    android:id="@+id/image"
                    android:layout_width="match_parent"
                    android:layout_height="200dp"
                    android:src="@drawable/common_ic_googleplayservices"/>

                <EditText
                    android:id="@+id/input"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="50dp"
                    android:layout_marginLeft="20dp"
                    android:layout_marginRight="20dp"
                    android:layout_below="@id/image"
                    android:hint="Input"
                    android:inputType="text"/>

                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:layout_below="@id/input"
                    android:orientation="vertical"
                    android:gravity="bottom|center_horizontal">

                    <Button
                        android:id="@+id/nextButton"
                        android:layout_width="match_parent"
                        android:layout_height="48dp"
                        android:layout_marginLeft="20dp"
                        android:layout_marginRight="20dp"
                        android:enabled="false"
                        android:text="Next"/>

                </LinearLayout>

            </RelativeLayout>

        </android.support.v7.widget.CardView>

    </FrameLayout>

</ScrollView>
+5

All Articles