当键盘打开时,Recyclerview显示错误

时间:2016-04-06 15:19:12

标签: android keyboard android-recyclerview

嗨,我有下一个问题:

我有3个textviews和下面的RecyclerView。当我触摸其中一个时,键盘出现,RecyclerView的内容隐藏。我检查线性布局是否已移动。

这是我的xml:

<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">

<android.support.design.widget.AppBarLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:theme="@style/ThemeOverlay.AppCompat.Dark">

    <android.support.v7.widget.Toolbar
        android:id="@+id/toolbar"
        android:layout_width="match_parent"
        android:layout_height="wrap_content">

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

</android.support.design.widget.AppBarLayout>

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    android:padding="16dp"
    android:gravity="center">

    <android.support.v7.widget.CardView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        card_view:cardElevation="2dp"
        card_view:cardUseCompatPadding="true"
        card_view:cardPreventCornerOverlap="true">

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical"
            android:padding="8dp">

            <android.support.design.widget.TextInputLayout
                android:id="@+id/input_layout_name"
                android:layout_width="match_parent"
                android:layout_height="wrap_content">

                <EditText
                    android:id="@+id/text_view_name"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    style="@style/EditText"
                    android:hint="@string/name"
                    android:inputType="text"/>
            </android.support.design.widget.TextInputLayout>

            <android.support.design.widget.TextInputLayout
                android:id="@+id/input_layout_description"
                android:layout_width="match_parent"
                android:layout_height="wrap_content">

                <EditText
                    android:id="@+id/text_view_description"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    style="@style/EditText"
                    android:hint="@string/tournament_description"
                    android:inputType="text"
                    />
            </android.support.design.widget.TextInputLayout>

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="horizontal">

                <android.support.design.widget.TextInputLayout
                    android:id="@+id/input_layout_sport"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_weight="1">

                    <EditText
                        android:id="@+id/text_view_sport"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        style="@style/EditText"
                        android:hint="@string/sport"
                        android:inputType="text"
                        />
                </android.support.design.widget.TextInputLayout>

                <android.support.design.widget.TextInputLayout
                    android:id="@+id/input_layout_max_players"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_weight="2">

                    <EditText
                        android:id="@+id/text_view_max_players"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        style="@style/EditText"
                        android:hint="@string/max_players"
                        android:inputType="number"
                        />
                </android.support.design.widget.TextInputLayout>

            </LinearLayout>

            <android.support.v7.widget.RecyclerView
                android:id="@+id/recycler_view"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"/>

        </LinearLayout>

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

    <Button
        android:id="@+id/button_add_tournament"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="@string/add"
        android:background="@color/colorAccent"
        android:textColor="@android:color/white"
        android:layout_marginTop="20dp"
        android:elevation="2dp" />

</LinearLayout>

enter image description here

0 个答案:

没有答案