0

I use persistent bottom sheet view in coordinatorLayout. my layout:

<androidx.coordinatorlayout.widget.CoordinatorLayout
    android:id="@+id/coordinatorLayout"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <!-- main content -->
    <RelativeLayout
        android:id="@+id/mainContentLayout"
        android:layout_width="match_parent"
        android:layout_height="match_parent">

        <!-- i need Dragging this layout to slide up bottom sheet -->

    </RelativeLayout>

    <!-- persistent bottom sheet -->
    <androidx.appcompat.widget.LinearLayoutCompat
        android:id="@+id/bottomSheet"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical"
        app:layout_behavior="@string/bottom_sheet_behavior"
        app:behavior_hideable="false"
        app:behavior_peekHeight="70dp">

        <!-- content bottom sheet (recyclerview or ...) -->

    </androidx.appcompat.widget.LinearLayoutCompat>

</androidx.coordinatorlayout.widget.CoordinatorLayout>

and register bottom sheet view:

BottomSheetBehavior bottomSheetBehavior;
View bottomSheet = findViewById(R.id.bottomSheet);
bottomSheetBehavior = BottomSheetBehavior.from(bottomSheet);
bottomSheetBehavior.setHideable(false);

now, in addition to slide through bottom R.id.bottomSheet, I also need dragging main content R.id.mainContentLayout to slide up bottomSheet.

How to add this feature?

enter image description here

Farzad
  • 1,975
  • 1
  • 25
  • 47
  • You want your content to slide up WITH the bottom sheet, right? – Vucko Jul 31 '19 at 08:29
  • @Vucko No. only need slide up bottomSheet from main content.when i sliding up on content, bottom sheet slide up. – Farzad Jul 31 '19 at 08:32
  • Are you sure you don't want to use a `nested scroll view` for such behavior? Because to me, it looks like you could have a layout with 2 fragments one below the other, with a small View in between. You can make the scroller disable for a while and when the user clicks the View, you can make the screen scroll [programmically](https://stackoverflow.com/a/8684666/7500651) – ansh sachdeva Jul 31 '19 at 08:35
  • @anshsachdeva no i dont need `nestedScrollView`. Because my `recyclerView` have large rows with header. i just need sliding from main content – Farzad Jul 31 '19 at 08:37
  • @Vucko can you help me? for (content to slide up WITH the bottom sheet) i can use `CollapsingToolbarLayout` with `app:layout_scrollFlags="scroll|snap"`, but behavior is lag and bug. – Farzad Jul 31 '19 at 09:11
  • bottomSheet height was match_parent, make it wrap.. try once.. – satyan_android Jul 31 '19 at 10:15
  • @anshsachdeva This is not the answer to my question. Pay attention to my question – Farzad Jul 31 '19 at 19:46

0 Answers0