【发布时间】:2017-06-14 15:01:31
【问题描述】:
我正在尝试在启动操作模式时在Coordinatorlayout 中的Recyclerview 下方显示一个视图。但直到我向下滚动底部视图是不可见的。如果我删除app:layout_behavior="@string/appbar_scrolling_view_behavior",
我得到了我想要的,但是 Recyclerview 位于工具栏下方。关于如何使用Coordinatorlayout 让视图始终可见的任何建议。
主要布局:
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:fab="http://schemas.android.com/apk/res-auto"
android:id="@+id/main_content"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="false">
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/AppTheme.AppBarOverlay">
<include layout="@layout/toolbar" />
</android.support.design.widget.AppBarLayout>
<include layout="@layout/list" />
</android.support.design.widget.CoordinatorLayout>
列表布局:
<RelativeLayout 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:orientation="vertical"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<LinearLayout
android:id="@+id/bottomView"
android:layout_width="match_parent"
android:layout_height="200dp"
android:layout_alignParentBottom="true"
android:background="@color/colorPrimary"
android:orientation="vertical">
</LinearLayout>
<android.support.v4.widget.SwipeRefreshLayout
android:id="@+id/swipeRefreshLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="@+id/layoutDummy">
<android.support.v7.widget.RecyclerView
android:id="@+id/recyclerView"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
</android.support.v4.widget.SwipeRefreshLayout>
</RelativeLayout>
【问题讨论】:
标签: android android-recyclerview android-coordinatorlayout