小编ale*_*exk的帖子

打开SoftKeyboard时,RecyclerView会隐藏Actionbar

我有以下布局

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:id="@+id/container">

    <com.example.SendMessageLayout
        android:id="@+id/chatMessageLayout"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        />

    <View
        android:id="@+id/separator"
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_above="@id/chatMessageLayout"
        android:background="@color/seperator_line_inpost"
        />

    <android.support.v4.widget.SwipeRefreshLayout
        android:id="@+id/swipe_container"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_alignParentTop="true"
        android:layout_above="@id/separator"
        >

        <android.support.v7.widget.RecyclerView
            android:id="@+id/recycleView"
            style="@style/BeepMeListView"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_above="@+id/chatMessageLayout"
            android:layout_alignParentTop="true"
            android:transcriptMode="alwaysScroll"
            />
    </android.support.v4.widget.SwipeRefreshLayout>

</RelativeLayout>
Run Code Online (Sandbox Code Playgroud)

而SendMessageLayout只是一个包含EditText和Button的布局.在旧的实现中我使用普通的旧ListView,所以当我请求焦点编辑文本时,键盘会出现,listview没有移动,第一个项目是可见的.但是随着RecyclerView的推出,一切都被推高了,不仅顶部项目不在屏幕之外,而且整个布局都在ActionBar之上.

这是它的样子...... RecycleView截图

android listview android-layout android-5.0-lollipop android-recyclerview

7
推荐指数
1
解决办法
1851
查看次数