Android IDE (AIDE) Support Forum

How to implement BottomNavigationView In Aide

How to implement BottomNavigationView In Aide

You can use Material Design for this.

This project was made with AIDE [ mod ]

MainActivity.java

package com.yourpackage.app

import android.os.Bundle;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;
import com.google.android.material.bottomnavigation.BottomNavigationView;
import androidx.annotation.NonNull;
import android.view.MenuItem;

public class MainActivity extends AppCompatActivity implements BottomNavigationView.OnNavigationItemSelectedListener {
    private BottomNavigationView navigationView;

	
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
		Toolbar toolbar = findViewById(R.id.toolbar);
		setSupportActionBar(toolbar);
		
		navigationView = findViewById(R.id.navigationView);
        navigationView.setOnNavigationItemSelectedListener(this);
    }
	
	@Override
    public boolean onNavigationItemSelected(@NonNull MenuItem item) {

        switch (item.getItemId()) {
            case R.id.nav_a: {
					break;
				}
            case R.id.nav_b: {
					break;
				}
            case R.id.nav_c: {
					break;
				}
        }
        return true;
    }
    
}

res/menu/menu_bottom.xml

<?xml version="1.0" encoding="utf-8"?>
<menu
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    tools:showIn="navigation_view">

    <group android:checkableBehavior="single">
        <item
            android:id="@+id/nav_a"
            android:checked="true"
            android:title="A" />
        <item
            android:id="@+id/nav_b"
            android:title="B" />
        <item
            android:id="@+id/nav_c"
            android:title="C" />
    </group>
</menu>

res/layout/activity_main.xml

<?xml version="1.0" encoding="utf-8"?>
<androidx.coordinatorlayout.widget.CoordinatorLayout
	xmlns:android="http://schemas.android.com/apk/res/android"
	xmlns:app="http://schemas.android.com/apk/res-auto"
	android:layout_width="match_parent"
	android:layout_height="match_parent"
	android:orientation="vertical">

	<com.google.android.material.appbar.AppBarLayout
		android:layout_width="match_parent"
		android:layout_height="wrap_content"
		android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">
		
		<androidx.appcompat.widget.Toolbar
			android:id="@+id/toolbar"
			android:layout_width="match_parent"
			android:layout_height="?attr/actionBarSize"
		    app:popupTheme="@style/ThemeOverlay.AppCompat.Light"/>

	</com.google.android.material.appbar.AppBarLayout>

	<androidx.core.widget.NestedScrollView
		android:id="@+id/id_nested_main"
		android:layout_width="match_parent"
		android:layout_height="match_parent"
		app:layout_behavior="com.google.android.material.appbar.AppBarLayout$ScrollingViewBehavior">

		<!-- Your Content Here -->

	</androidx.core.widget.NestedScrollView>
	
	<com.google.android.material.bottomnavigation.BottomNavigationView
		android:id="@+id/navigationView"
		android:layout_width="match_parent"
		android:layout_height="wrap_content"
		android:layout_gravity="bottom"
		app:itemBackground="@color/colorPrimary"
		app:itemTextColor="@drawable/bottom_item_background_color"
		app:menu="@menu/menu_bottom"/>

</androidx.coordinatorlayout.widget.CoordinatorLayout>