Reputation: 331
Is it possible to open a BottomSheet
behind another view? (In my case a button)
What kind of layout should I use for that?
Upvotes: 4
Views: 2763
Reputation: 4168
You should be able to achieve this with a layout like this one, which worked in my case:
<androidx.coordinatorlayout.widget.CoordinatorLayout>
<View
android:id="@+id/bottomSheet"
app:layout_behavior="com.google.android.material.bottomsheet.BottomSheetBehavior"/>
<View android:id="@+id/viewYouWantAbove"/>
</androidx.coordinatorlayout.widget.CoordinatorLayout>
So the view you want to be above the bottom sheet simply needs to be after the bottom sheet in the xml.
Note: If your bottom sheet has an elevation, the other view must have a superior or equal elevation to be above.
Upvotes: 2