Bottom sheet margin top not working correctly - Android Bottom sheet margin top not working correctly - Android xml xml

Bottom sheet margin top not working correctly - Android


One option is to use a Toolbar instead of adding a margin to the BottomSheet. You can put this inside the CoordinatorLayout at the top so it will be behind the BottomSheet. Make sure the View that has the BottomSheetBehavior is at the bottom of the layout and that it has a higher elevation than the Toolbar.


I can suggest you to change the root layout - from CoordinatorLayout to any other (Relative/Linear and so on). And after that you can add your CoordinatorLayout in your new root ViewGroup with desired marginTop.

android:layout_width="match_parent"android:layout_height="match_parent"android:layout_marginTop="80dp"