The Blog

➤ How to add footer to NavigationView

28 Ago 15

NavigationView was recently added by the Android support team to help developers deliver consistent NavigationDrawer Menu across apps. It’s usage is super simple thanks to its support of native menu’s xml resource files.

Such simplicity comes with a drawback. You can add menu items, an header but not a footer. After investigating a little I saw the NavigationView actually uses a ListView to display the menu and the given header is added through the ListView.addHeaderView method.

Note: the ListView used in NavigationView is an istance of NavigationMenuView.

Well, to add a scrolling footer you’ll just need to call the ListView.addFooterView method after the view has been created. Hence if you’re within a fragment just drop this:

Comments

  • Rolando

    Nice hack! it’s working 😀

  • benjosantony

    As of the support library version 23.1.1 NavigationMenuView is a recycler view.

  • Andrea Baccega

    Yep. Did you find any workaround yet?

  • http://blog.alexsimo.com/ Alexandru Simonescu

    Not bad approach but still a hack..
    And in fact, now the NavigationView is a recycler view 🙁

  • Jehandad Kamal

    Good question, if could only override the prepareMenu method in the NavigationAdapter.!