Reputation: 1
enter image description hereI am developing an app in android and I want to implement a menu similar to the image, does anyone have any examples of how to do it?
Upvotes: 0
Views: 262
Reputation: 3511
Use the SpaceNavigationView library to get the Bottom Navigation Bar similar to your required design.
Other libraries you can have a look.
Upvotes: 0
Reputation: 1333
Definitely you should use Fragment
for each bottom navigation Item / Tab
. Like FragmentHome
, FragmentSearch
and FragmentSettings
.
To change the Fragment
, add NavigationItemSelectedListener
to your BottomNavigationView
and change Fragment
as per MenuItem
selection:
BottomNavigationView bottomNavigationView = (BottomNavigationView)
findViewById(R.id.bottom_navigation_view);
bottomNavigationView.setOnNavigationItemSelectedListener
(new BottomNavigationView.OnNavigationItemSelectedListener() {
@Override
public boolean onNavigationItemSelected(@NonNull MenuItem item) {
Fragment selectedFragment = null;
switch (item.getItemId()) {
case R.id.action_item1:
selectedFragment = FragmentHome.newInstance();
break;
case R.id.action_item2:
selectedFragment = FragmentSearch.newInstance();
break;
case R.id.action_item3:
selectedFragment = FragmentSettings.newInstance();
break;
}
FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
transaction.replace(R.id.frame_layout, selectedFragment);
transaction.commit();
return true;
}
});
Here is a tutorial about: BottomNavigationView with multiple Fragments
Here is an useful link:
Hope this will help to understand the scenario.
Upvotes: 1
Reputation: 520
You can find your answer here: Which view should be used for new Material Design Bottom Navigation?
here is a github project for bottom menu: https://github.com/roughike/BottomBar
Upvotes: 0