I am trying to make a bottom navigation bar that changes the activity based on the button but whenever I try the tutorials there is one error or another
Asked
Active
Viewed 1,768 times
0
-
Android Studio (2.3) mostly likely isn't the problem. Please post your errors – OneCricketeer Jul 18 '17 at 00:28
-
What are the errors you are receiving? – Abhi Jul 18 '17 at 01:11
-
Hi , i think using bottom navigation bar for changing the activity would be bad idea, use fragments instead.You can try the activity template of bottom navigation in android studio. – SriMaharshi Manchem Jul 18 '17 at 06:22
-
Try this https://stackoverflow.com/questions/36032177/android-new-bottom-navigation-bar – Jins Lukose Jul 18 '17 at 08:16
3 Answers
0
I think if You want something as a nav bar You should try getting to GitHub because there are many great things there like: https://github.com/Nightonke/BoomMenu
Try it, looks way better than a simple nav bar. cheers

z3r0
- 39
- 1
- 7
0
you can use this library for bottomnavifationbar
github lib , github lib 2 , githublib 3, github lib 4,
or try this
complie this depedencie
compile ‘com.android.support:design:25.3.1’
create a layout like this
<?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"
android:layout_width="match_parent"
android:layout_height="match_parent">
<!-- Content Container -->
<android.support.design.widget.BottomNavigationView
android:id="@+id/bottom_navigation"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
app:itemBackground="@color/colorPrimary"
app:itemIconTint="@color/white"
app:itemTextColor="@color/white"
app:menu="@menu/bottom_navigation_main" />
</RelativeLayout>
create menu as per your reqirement
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<item
android:id="@+id/action_favorites"
android:enabled="true"
android:icon="@drawable/ic_favorite_white_24dp"
android:title="@string/text_favorites"
app:showAsAction="ifRoom" />
<item
android:id="@+id/action_schedules"
android:enabled="true"
android:icon="@drawable/ic_access_time_white_24dp"
android:title="@string/text_schedules"
app:showAsAction="ifRoom" />
<item
android:id="@+id/action_music"
android:enabled="true"
android:icon="@drawable/ic_audiotrack_white_24dp"
android:title="@string/text_music"
app:showAsAction="ifRoom" />
**Handling Enabled / Disabled states. Make selector file.**
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:color="@color/white" android:state_enabled="true" />
<item android:color="@color/colorPrimaryDark" android:state_enabled="false" />
</selector>
handle click events
BottomNavigationView bottomNavigationView = (BottomNavigationView)
findViewById(R.id.bottom_navigation);
bottomNavigationView.setOnNavigationItemSelectedListener(
new BottomNavigationView.OnNavigationItemSelectedListener() {
@Override
public boolean onNavigationItemSelected(@NonNull MenuItem item) {
switch (item.getItemId()) {
case R.id.action_favorites:
break;
case R.id.action_schedules:
break;
case R.id.action_music:
break;
}
return false;
}
});

AskNilesh
- 67,701
- 16
- 123
- 163
-1
The official is no longer supported, so you can try radiobutton and viewpager.

Oussama Ben Ghorbel
- 2,132
- 4
- 17
- 34

Great developers
- 1
- 1
-
False information : https://developer.android.com/reference/android/support/design/widget/BottomNavigationView.html – reTs Jul 18 '17 at 03:09
-
i get it ,so thank you for your suggestion and hope more communication with you 。 – Great developers Jul 31 '17 at 07:20
-
-
-