How to Add Footer to Navigationview - Android Support Design Library

How to add a footer to android menu drawer (navigation view)

There is no direct support in NavigationView to add footer . You can remove navigation view and a ListView in place of it and add header and footer to ListView .

<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:openDrawer="start">

<include
layout="@layout/app_bar_home"
android:layout_width="match_parent"
android:layout_height="match_parent" />

<ListView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/listView_nav"
android:layout_gravity="start"
android:background="@color/white"
android:fitsSystemWindows="true"/>

</android.support.v4.widget.DrawerLayout>

check how to add footer to listView here

Scrollable footer in Drawer

According to @Adreamus answer to the question How to add footer to NavigationView - Android support design library?

you could make it by 2 navigation views, look at this app example on Github

Also, I suggest you use MaterialDrawer Library it will save you a lot of time

Sample Image



Related Topics



Leave a reply



Submit