Skip to main content

Top Android NavigationView Libraries

Top Android NavigationView Libraries.

The NavigationView is a common UI component in Android that provides a navigation menu, typically used in conjunction with the DrawerLayout to create a navigation drawer. While the default implementation of NavigationView is sufficient for basic needs, there are several libraries available that offer additional features and customization options.

In this tutorial, we will explore some of the top Android NavigationView libraries, discuss their features, and provide step-by-step installation instructions. We will also include code usage examples in Kotlin or Java, as applicable.

1. MaterialDrawer

The first library we'll discuss is MaterialDrawer by Mike Penz. MaterialDrawer provides a powerful and flexible implementation of the navigation drawer with a wide range of customization options.

Features

  • Easy integration with minimal setup
  • Customizable drawer items, headers, and footers
  • Support for multiple item types, such as sections, dividers, and switch items
  • Built-in support for badges and counters
  • Theming options to match your app's design
  • Support for RTL (Right-to-Left) layouts
  • Extensive API for programmatic control

Installation

To install MaterialDrawer, add the following dependency to your app-level build.gradle file:

implementation 'com.mikepenz:materialdrawer:7.2.8'

Usage Example (Kotlin)

Here's a simple example demonstrating how to create a basic NavigationView using MaterialDrawer in Kotlin:

val drawer = DrawerBuilder()
.withActivity(this)
.build()

drawer.addItem(PrimaryDrawerItem().withName("Item 1"))
drawer.addItem(PrimaryDrawerItem().withName("Item 2"))

drawer.setOnDrawerItemClickListener { view, position, drawerItem ->
// Handle item click
true
}

For more information and advanced usage, refer to the MaterialDrawer GitHub repository.

2. NavigationViewEx

NavigationViewEx is another popular library that extends the functionality of the default NavigationView provided by Android. It offers additional features and customization options.

Features

  • Support for custom item layouts
  • Badge support for items
  • Item click listeners with position and ID
  • Item drag and drop functionality
  • Customizable item colors, text styles, and icons
  • RTL (Right-to-Left) support
  • Integration with ViewPager for tab-like navigation

Installation

To install NavigationViewEx, add the following dependency to your app-level build.gradle file:

implementation 'com.github.yarolegovich:NavigationViewEx:2.0.0'

Usage Example (Java)

Here's an example demonstrating how to use NavigationViewEx in Java:

NavigationViewEx navigationView = findViewById(R.id.navigation_view);
navigationView.enableItemShiftingMode(false);
navigationView.enableShiftingMode(false);
navigationView.setTextVisibility(false);

navigationView.setOnNavigationItemSelectedListener(new NavigationView.OnNavigationItemSelectedListener() {
@Override
public boolean onNavigationItemSelected(@NonNull MenuItem menuItem) {
// Handle item click
return true;
}
});

For more information and advanced usage, refer to the NavigationViewEx GitHub repository.

Additional Libraries

Here are a few more popular libraries that offer extended functionality for NavigationView:

  • AHBottomNavigation: A library that combines the NavigationView with a bottom navigation bar. GitHub repository
  • BubbleNavigation: A library that provides a bubble-like navigation menu. GitHub repository
  • NavigationTabStrip: A library that adds a customizable tab strip to the NavigationView. GitHub repository

Feel free to explore these libraries and choose the one that best fits your project's requirements.

That concludes our tutorial on the top Android NavigationView libraries. We've discussed MaterialDrawer and NavigationViewEx, provided installation instructions, and included code examples. Additionally, we've listed a few more libraries for further exploration. Happy coding!