Skip to content

Instantly share code, notes, and snippets.

@iamnaran
Created May 23, 2021 14:12
Show Gist options
  • Save iamnaran/dcd9470bef7c6125f314d8793a31c0f3 to your computer and use it in GitHub Desktop.
Save iamnaran/dcd9470bef7c6125f314d8793a31c0f3 to your computer and use it in GitHub Desktop.
Bottom Sheet Above Bottom Navigation
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout 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"
tools:context=".ui.main.MainActivity">
<androidx.coordinatorlayout.widget.CoordinatorLayout
android:layout_width="match_parent"
android:layout_height="0dp"
app:layout_constraintBottom_toTopOf="@+id/bottom_navigation_view"
app:layout_constraintTop_toTopOf="parent"
tools:context=".ui.main.MainActivity">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<fragment
android:id="@+id/container"
android:name="androidx.navigation.fragment.NavHostFragment"
android:layout_width="match_parent"
android:layout_height="0dp"
android:background="@color/colorPrimary"
app:defaultNavHost="true"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:navGraph="@navigation/nav_graph" />
</androidx.constraintlayout.widget.ConstraintLayout>
<include
android:id="@+id/bottom_sheet_parent"
layout="@layout/item_bottom_sheet_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/background_bottom_sheet"
app:layout_anchorGravity="bottom"
app:layout_behavior="com.google.android.material.bottomsheet.BottomSheetBehavior">
</include>
</androidx.coordinatorlayout.widget.CoordinatorLayout>
<com.google.android.material.bottomnavigation.BottomNavigationView
android:id="@+id/bottom_navigation_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:background="@color/colorPrimary"
app:contentInsetEnd="0dp"
app:contentInsetStart="0dp"
app:itemBackground="@color/colorPrimary"
app:itemIconTint="@drawable/bottom_navigation_selector"
app:itemRippleColor="@color/colorAccent"
app:itemTextColor="@color/colorPrimaryText"
app:labelVisibilityMode="labeled"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:menu="@menu/bottom_nav_menu" />
</androidx.constraintlayout.widget.ConstraintLayout>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment