RecyclerView, завернутый в CoordinatorLayout, не изменяется при открытии клавиатуры

XML макет активности:

<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:fitsSystemWindows="true">

    <android.support.design.widget.AppBarLayout
        android:id="@+id/app_bar_layout"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:fitsSystemWindows="true"
        android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">

        <android.support.design.widget.CollapsingToolbarLayout
            android:id="@+id/collapsing_toolbar"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:fitsSystemWindows="true"
            app:contentScrim="?attr/colorPrimary"
            app:expandedTitleMarginEnd="64dp"
            app:expandedTitleMarginStart="48dp"
            app:layout_scrollFlags="scroll">

            <FrameLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:fitsSystemWindows="true"
                app:layout_collapseMode="parallax">

                <ImageView
                    android:layout_width="match_parent"
                    android:layout_height="250dp"
                    android:scaleType="centerCrop"
                    android:src="@drawable/hospital_logo" />

                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_gravity="bottom"
                    android:orientation="vertical"
                    android:padding="10dp">

                    <TextView
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="******* ************* ********** ************"
                        android:textSize="18sp"
                        android:textColor="@android:color/black"
                        android:textStyle="bold"/>

                    <TextView
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:text="***************************"
                        android:textSize="18sp"
                        android:textColor="@android:color/black"
                        android:textStyle="bold"/>

                </LinearLayout>

            </FrameLayout>

            <android.support.v7.widget.Toolbar
                android:id="@+id/toolbar"
                android:layout_width="match_parent"
                android:layout_height="?attr/actionBarSize"
                app:layout_collapseMode="pin"
                app:popupTheme="@style/ThemeOverlay.AppCompat.Light" />

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

        <android.support.design.widget.TabLayout
            android:id="@+id/tabs"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            app:tabMode="fixed" />

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

    <android.support.v4.view.ViewPager
        android:id="@+id/viewpager"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
    app:layout_behavior="@string/appbar_scrolling_view_behavior" />

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

Здесь я использую CoordinatorLayout с CollapsingToolbarBar и ViewPager.

У меня есть два фрагмента внутри ViewPager с макетом xml:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical">

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

</LinearLayout>

Ячейка recycler_view содержит EditText. Когда я выбираю EditText, открывается SoftKeyboard, но EditText прячется за клавиатурой.

Я добавил в активность следующие флаги:

android:windowSoftInputMode="adjustResize"

Я использую версию RecyclerView 23.1.1 appcompat.

Когда я заменяю CoordinatorLayout на LinearLayout, RecyclerView изменяется размер, чтобы правильно отображать последний элемент. Поэтому я думаю, что это проблема с макетом координатора.

Я столкнулся со следующими проблемами: https://code.google.com/p/android/issues/detail?id=176406 и https://code.google.com/p/android/issues/detail?id=176187, но это не связано с этой ошибкой. Дайте мне знать, если я могу применить какой-то путь, чтобы решить эту проблему.

Ожидание ответа. Спасибо. Дайте мне знать, если потребуется дополнительная информация.


person Sagar Trehan    schedule 17.01.2016    source источник
comment
Я очень старался исправить это. В конце концов я создал для него выпуск Android. Я поделился своим фиктивным проектом, чтобы проиллюстрировать проблему. проверьте статус проблемы по следующей ссылке: code.google.com/p/android/issues/   -  person Sagar Trehan    schedule 19.01.2016
comment
@streamride Нет, я не могу это исправить. Я изменил дизайн, чтобы исправить проблему.   -  person Sagar Trehan    schedule 11.08.2016


Ответы (1)


У меня была очень похожая проблема, и я смог ее исправить с помощью android:windowSoftInputMode="adjustPan".

person Michael    schedule 31.03.2016