Skip to content

Instantly share code, notes, and snippets.

@wajahatkarim3
Created January 5, 2020 21:27
Show Gist options
  • Save wajahatkarim3/7f7da3e44bd072407787d93e72aa0f39 to your computer and use it in GitHub Desktop.
Save wajahatkarim3/7f7da3e44bd072407787d93e72aa0f39 to your computer and use it in GitHub Desktop.
The layout of main bottom navigation activity for navigation components
<?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">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="0dp"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toTopOf="@+id/bottomNavView">
<fragment
android:id="@+id/fragNavHost"
android:name="androidx.navigation.fragment.NavHostFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:defaultNavHost="true"
app:navGraph="@navigation/bottom_nav_graph" />
</FrameLayout>
<com.google.android.material.bottomnavigation.BottomNavigationView
android:id="@+id/bottomNavView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:background="@color/colorWhite"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_behavior="@string/hide_bottom_view_on_scroll_behavior"
style="@style/Widget.MaterialComponents.BottomNavigationView"
app:itemIconTint="@color/color_bottom_icon"
app:itemTextColor="@color/color_bottom_icon"
app:menu="@menu/bottom_navigation_menu"/>
</androidx.constraintlayout.widget.ConstraintLayout>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment