I would like to make the icon sitting the top of the bottom sheet instead of overlapping to the bottom sheet.
Here is my xml code:
<androidx.coordinatorlayout.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:layout_width="match_parent"
android:layout_height="match_parent">
<include layout="@layout/bottom_sheet_layout" />
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/floatingActionButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:layout_marginBottom="16dp"
android:src="@drawable/my_img_resource"
app:layout_anchor="@+id/bottom_sheet"
app:layout_anchorGravity="center_horizontal|top" />
</androidx.coordinatorlayout.widget.CoordinatorLayout>
The bottom sheet xml is like:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:id="@+id/bottom_sheet"
android:layout_height="match_parent"
xmlns:tools="http://schemas.android.com/tools"
android:orientation="vertical">
</LinearLayout>
After the bottom sheet is rendered, the image is at the middle top but overlapping with the bottom sheet. How can I make the image sit at the very top of it?