explaingit

mikepenz/materialdrawer

11,649KotlinAudience · developerComplexity · 2/5Setup · easy

TLDR

MaterialDrawer is an Android library that adds a ready-made Material Design navigation drawer, the sliding side panel with icons, badges, and account switching, to any Android app without building it from scratch.

Mindmap

mindmap
  root((MaterialDrawer))
    What it does
      Navigation drawer
      Material Design UI
      Account switcher
    Features
      Badge counters
      Expandable items
      Sticky header footer
      NavController support
    Tech stack
      Kotlin
      AndroidX
      RecyclerView
    Setup
      Gradle dependency
      DrawerLayout XML
      Code configuration
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Things people build with this

USE CASE 1

Add a Material Design navigation drawer with icons and badge counters to an Android app using a few lines of Kotlin.

USE CASE 2

Display a user profile switcher at the top of the nav drawer with profile photos and email addresses.

USE CASE 3

Integrate the drawer with Android Jetpack NavController so tapping a drawer item navigates to the correct screen automatically.

USE CASE 4

Build an expandable, grouped navigation menu with a sticky footer and header that stays fixed while the list scrolls.

Tech stack

KotlinAndroidRecyclerViewAndroidX

Getting it running

Difficulty · easy Time to first run · 30min

Add a Gradle dependency, place the SliderView in a DrawerLayout XML, and configure items in code, no extra infrastructure required.

The explanation does not specify the license for this library.

In plain English

MaterialDrawer is an Android library that makes it straightforward to add a navigation drawer to any Android app. A navigation drawer is the sliding side panel that appears when you swipe from the left edge of the screen or tap a hamburger menu icon, and it typically lists sections or screens your app can navigate to. This library handles the visual design and wiring so you do not have to build that UI from scratch. The library follows Google Material Design guidelines and is built on top of Android's RecyclerView and AndroidX support libraries. It works back to API Level 16, which covers nearly all Android devices in use today. Version 9 brings Material 3 theming support, while older versions supporting Java and the earlier AppCompat library are still available as archived releases. Out of the box, MaterialDrawer includes several item types: primary items, secondary items, dividers, and section headers. It also has a built-in account switcher called AccountHeader, which lets you display user profile images and emails at the top of the drawer and switch between accounts. Other included features are badge counters on items, expandable items, a sticky footer and header that stay fixed while the list scrolls, right-to-left layout support, a Gmail-style mini drawer, and NavController integration for apps using Android Jetpack navigation. Icons can come from any font icon set through a companion extension that connects to the Android-Iconics library. You can use Google Material Icons, FontAwesome, or any other supported icon font without needing image files. Setup involves adding a Gradle dependency, placing the library's slider view inside a DrawerLayout in your XML layout file, and applying a theme style. After that, you add items through code and attach click listeners to respond to selections.

Copy-paste prompts

Prompt 1
Show me the Gradle dependency and minimum Kotlin code to add a MaterialDrawer with three navigation items to my Android Activity.
Prompt 2
How do I add an AccountHeader to MaterialDrawer that shows two user profiles with photos and lets the user switch between them?
Prompt 3
I want badge counters on my MaterialDrawer navigation items, show me how to set and update the badge count programmatically in Kotlin.
Prompt 4
Help me wire up MaterialDrawer with Android Jetpack NavController so tapping a drawer item navigates to the correct fragment.
Open on GitHub → Explain another repo

← mikepenz on gitmyhub — every repo by this author, as a profile.

Verify against the repo before relying on details.