Create Drawable in New to Resource File:
Name: item_selector:
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true"
android:color="@color/white"
/>
<item android:state_checked="true"
android:color="@color/white"
/>
<item android:color="#08B2FF"/>
</selector>
And also take the Button Image in Drawable.
Create New Directory:
Click on Right Button:
rec-->New-->Directory-->menu
item_menu
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="@+id/home"
android:icon="@drawable/home"
android:title="Home"
/>
<item android:id="@+id/moreapps"
android:icon="@drawable/more_apps"
android:title="More Apps"
/>
<item android:id="@+id/share"
android:icon="@drawable/share"
android:title="Share"
/>
<item android:id="@+id/update"
android:icon="@drawable/update"
android:title="Update"
/>
<item android:id="@+id/subscribe"
android:icon="@drawable/subscribe"
android:title="Subscribe"
/>
</menu>
Place it in Main Activity: XML
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
>
<com.google.android.material.bottomnavigation.BottomNavigationView
android:id="@+id/bottomNavigationView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:background="@drawable/golbutton"
app:itemIconTint="@drawable/item_selector"
app:itemRippleColor="@android:color/transparent"
app:labelVisibilityMode="labeled"
app:itemTextColor="@color/black"
app:menu="@menu/item_menu"
/>
</RelativeLayout>
//-------------------------------
Make it identity: /
Porichoy Korte hobe:
BottomNavigationView bottomNavigationView;
bottomNavigationView = findViewById(R.id.bottomNavigationView);
bottomNavigationView.setOnNavigationItemSelectedListener(new BottomNavigationView.OnNavigationItemSelectedListener() {
@Override
public boolean onNavigationItemSelected(@NonNull MenuItem item) {
switch (item.getItemId()){
case R.id.home:
Toast.makeText(MainActivity.this, "Home",Toast.LENGTH_SHORT).show();
break;
case R.id.moreapps:
try {
startActivity(new Intent(Intent.ACTION_VIEW,Uri.parse("https://play.google.com/store/apps/developer?id=STROPURBO")));
}catch (ActivityNotFoundException e){
startActivity(new Intent(Intent.ACTION_VIEW,Uri.parse("https://play.google.com/store/apps/details?id="+getPackageName())));
}
break;
case R.id.update:
try {
startActivity(new Intent(Intent.ACTION_VIEW,Uri.parse("market://details?id="+getPackageName())));
}catch (Exception e){
}
break;
case R.id.share:
try {
Intent i = new Intent(Intent.ACTION_SEND);
i.setType("text/plain");
i.putExtra(Intent.EXTRA_SUBJECT, "SSC Board Questions");
i.putExtra(Intent.EXTRA_TEXT, "https://play.google.com/store/apps/details?id=" + getApplicationContext().getPackageName());
startActivity(Intent.createChooser(i, "Share"));
}catch (Exception e){
}
break;
case R.id.subscribe:
try {
startActivity(new Intent(Intent.ACTION_VIEW,Uri.parse("https://www.youtube.com/c/STROpurbo/")));
}catch (Exception e){
}
break;
}
return true;
}
});