Bottom Navigation Bar




mainActivity.xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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"
android:gravity="center"
android:orientation="vertical"
tools:context=".ShowImage">


<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent">

<FrameLayout
android:id="@+id/frame_container"
android:layout_width="match_parent"
android:layout_height="match_parent" />

<LinearLayout
android:layout_width="350dp"
android:layout_height="60dp"
android:layout_gravity="bottom|center"
android:layout_marginBottom="50dp"
android:background="@drawable/shape"
android:gravity="center_vertical">

<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:id="@+id/btn"
android:gravity="center">

<ImageView
android:layout_width="30dp"
android:layout_height="30dp"
android:src="@drawable/ic_outline_home_24"
android:tint="@color/white" />
</LinearLayout>

<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:id="@+id/btn1"
android:gravity="center">

<ImageView
android:layout_width="30dp"
android:layout_height="30dp"
android:src="@drawable/ic_baseline_search_24"
android:tint="@color/white" />
</LinearLayout>

<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:id="@+id/btn2"
android:gravity="center">

<ImageView
android:layout_width="30dp"
android:layout_height="30dp"
android:src="@drawable/ic_outline_settings_24"
android:tint="@color/white" />
</LinearLayout>


</LinearLayout>
</FrameLayout>

</LinearLayout>

mainActivity.Java

package com.example.myapplication10;

import androidx.annotation.NonNull;
import androidx.annotation.RequiresApi;
import androidx.appcompat.app.AppCompatActivity;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentTransaction;

import android.app.DatePickerDialog;
import android.app.TimePickerDialog;
import android.location.LocationManager;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.DatePicker;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.MediaController;
import android.widget.TimePicker;
import android.widget.Toast;
import android.widget.VideoView;

import com.bumptech.glide.Glide;
import com.example.myapplication10.Fragment.BottomFragment;
import com.example.myapplication10.Fragment.HomeFragment;
import com.google.android.gms.tasks.OnCompleteListener;
import com.google.android.gms.tasks.OnFailureListener;
import com.google.android.gms.tasks.OnSuccessListener;
import com.google.android.gms.tasks.Task;
import com.google.firebase.storage.FirebaseStorage;
import com.google.firebase.storage.ListResult;
import com.google.firebase.storage.StorageReference;

import java.util.ArrayList;
import java.util.Calendar;
import java.util.List;

public class ShowImage extends AppCompatActivity {


private FrameLayout frame_container;
private LinearLayout btn,btn1;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_show_image);

loadFragment(new HomeFragment());

frame_container = findViewById(R.id.frame_container);
btn = findViewById(R.id.btn);
btn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {

HomeFragment homeFragment = new HomeFragment();

loadFragment(homeFragment);
}
});

btn1 = findViewById(R.id.btn1);
btn1.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
BottomFragment bottomFragment=new BottomFragment();
loadFragment(bottomFragment);
}
});

}

void loadFragment(Fragment fragment) {

FragmentTransaction fragmentTransaction = getSupportFragmentManager().beginTransaction();
fragmentTransaction.replace(R.id.frame_container, fragment);
fragmentTransaction.commit();
}
}


NOTE : CREATE A NEW FRAGMENT & SET OBJECT OF FRAGMENT IN CLICK OF BUTTON