如何使列表的最后一项位于底部表单上方

5

我正在制作一个音乐播放器。我正在使用 bottomsheet。它正常工作并且有它的 peek 高度,但是它会遮盖 RecyclerView 的最后一项。我应该如何设置 recyclerViewBottomSheet 视图之上呢?请帮帮我。

这是我的 MainActivity 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"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/tab_root"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@color/white">

    <android.support.design.widget.AppBarLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content">

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

        <android.support.design.widget.TabLayout
            android:id="@+id/tab_layout"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:background="@color/orange"
            app:tabIndicatorColor="@color/colorAccent"
            app:tabIndicatorHeight="3dp"
            app:tabMode="fixed"
            app:tabTextColor="@color/white" />
    </android.support.design.widget.AppBarLayout>
    <android.support.v4.view.ViewPager
        android:id="@+id/pager"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        app:layout_behavior="@string/appbar_scrolling_view_behavior" />

    <!-- View useed to load other fragments so that my Bottomsheet can be seen above other fragments -->
    <FrameLayout
        android:id="@+id/fragment_container"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        />
    <!-- BottomSheet layout-->
    <FrameLayout
        android:id="@+id/framelayouts"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:elevation="8dp"
        android:clickable="true"
        app:layout_behavior="android.support.design.widget.BottomSheetBehavior">

        <include layout="@layout/layout_player_bottomsheet" />
    </FrameLayout>
</android.support.design.widget.CoordinatorLayout>

请建议应该做什么。
1个回答

6
在您的recyclerView中添加这两个属性。
android:clipToPadding="false"
android:paddingBottom="60dp"

它能够工作,但有时会卡住并且不能按照预期行动。为什么? - Anuj Sharma
你具体遇到了什么问题? - Masum
列表现在出现在底部表单上,但当我更改片段并再次返回时,它的行为与以前相同。最后一项会被放到底部表单的后面。 - Anuj Sharma
请检查您的RecyclerView行和底部表视图。如果RecyclerView行根布局为match_parent,则更改为wrap_content。 - Masum

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接