kozinakoff
@kozinakoff
iOS-developer

Как сделать так, чтобы RecyclerView не перекрывал ActionBar при появлении экранной клавиатуры?

Добрый день.

Никак не получается забороть следующую проблему: при появлении экранной клавиатуры RecyclerView уезжает вверх и закрывает собой Toolbar и Statusbar.

Исходные данные:
Есть Activity а-ля WhatsApp/Hangounts/etc

View следующей структуры:

<LinearLayout
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:orientation="vertical"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        >

    <RelativeLayout
            android:layout_width="fill_parent"
            android:layout_height="0dp"
            android:layout_weight="1"
            >

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

        <android.support.v4.widget.SwipeRefreshLayout
            android:id="@+id/swipe_container"
            android:layout_below="@+id/toolbar"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent">

        <android.support.v7.widget.RecyclerView
                android:id="@android:id/list"
                android:layout_width="fill_parent"
                android:layout_height="fill_parent"
                android:layout_weight="1"
                android:stackFromBottom="true"
                android:transcriptMode="normal"
                android:smoothScrollbar="false"
                android:listSelector="@android:color/transparent"
                android:dividerHeight="1dp"
                android:divider="@null" />

        </android.support.v4.widget.SwipeRefreshLayout>

        <TextView
                android:id="@+id/chat_page"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:padding="4dip"
                android:text="@string/no_chat_messages"
                />
    </RelativeLayout>

    <LinearLayout
            android:layout_marginTop="5dp"
            android:orientation="vertical"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content">
        <View
                android:layout_width="fill_parent"
                android:layout_height="2dp"
                android:background="@color/accentLight" />
        <LinearLayout
                android:orientation="horizontal"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:paddingTop="2dip">
            <EditText
                    android:id="@+id/chat_input"
                    android:layout_weight="1"
                    android:inputType="textShortMessage|textAutoCorrect|textCapSentences|textMultiLine"
                    android:imeOptions="actionSend|flagNoEnterAction"
                    android:cursorVisible="true"
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:maxLines="4"
                    android:maxLength="200"
                    android:scrollbars="vertical"
                    android:fadingEdge="vertical"
                    />
            <ImageButton
                    android:src="@drawable/send_button"
                    android:id="@+id/chat_send"
                    android:layout_width="wrap_content"
                    android:layout_height="fill_parent"
                    />
        </LinearLayout>
    </LinearLayout>

</LinearLayout>


В манифесте для данной Activity прописано android:windowSoftInputMode="stateHidden|adjustPan".

* adjustResize не предлагать, не помогает

Есть подозрения, что копать надо в сторону LinearLayoutManager'а, который задаётся для RecyclerView, но чего-то полезного нагуглить не удалось.

Может кто-нибудь сталкивался с таким и знает, как решить проблему?
  • Вопрос задан
  • 2974 просмотра
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы