Bottom Navigation
Bottom Navigation:
The Bottom Navigation is a Material Design pattern applicable to Android apps that shows a navigator in the bottom of the screen.
Depending on the design, it may include several symbols or titles reflecting the app’s sub-areas or targets.
When the icons are touched, they will take the users to various views or other aspects of that particular application.
Example:
// activity_main.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
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=".MainActivity">
<FrameLayout
android:id="@+id/frame_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="@id/bottom_navigation">
<TextView
android:id="@+id/text_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Bottom Navigation Name"
android:textColor="@color/colorWhite"
android:textStyle="bold"
android:textSize="28sp"
android:layout_gravity="center"/>
</FrameLayout>
<com.google.android.material.bottomnavigation.BottomNavigationView
android:id="@+id/bottom_navigation"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:background="@color/design_default_color_on_secondary"
app:itemIconTint="@color/colorWhite"
app:itemTextColor="@color/colorWhite"
app:menu="@menu/menu_item"
/>
</RelativeLayout>
// menu_item.xml
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:id="@+id/navigation_home"
android:icon="@drawable/ic_home_black_24dp"
android:title="Home" />
<item
android:id="@+id/navigation_favourite"
android:icon="@drawable/ic_baseline_favorite_24"
android:title="Favourite" />
<item
android:id="@+id/navigation_notification"
android:icon="@drawable/ic_baseline_notifications_24"
android:title="Notification" />
</menu>