Nouman
Nouman

Reputation: 31

BottomSheet peekHeight below recyclerview or any view

I want BottomSheet below RecyclerView. I don't want to give fixed value to bottom sheet peekHeight.

Is there any method to set it by layout_below or anything else that place bottom sheet below recyclerview ?

<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"
    tools:context=".Fragments.FragmentHome">

    <include
        android:id="@+id/layout_home_toolbar"
        layout="@layout/custom_toolbar" />

    <android.support.design.widget.CoordinatorLayout
        android:id="@+id/layout_home_coordinator"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_below="@id/layout_home_toolbar">

        <TextView
            android:id="@+id/tv_home_featured"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" />

        <android.support.v7.widget.RecyclerView
            android:id="@+id/rv_home_top"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_gravity="bottom"
            app:layout_anchor="@id/tv_home_featured"
            app:layout_anchorGravity="bottom" />

        <RelativeLayout
            android:id="@+id/bottom_sheet"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"                
    app:layout_behavior="android.support.design.widget.BottomSheetBehavior">

            <TextView
                android:id="@+id/tv_home_near"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content" />
        </RelativeLayout>
    </CoordinatorLayout>
</RelativeLayout>

Upvotes: 1

Views: 670

Answers (0)

Related Questions