Just like I can add header I want to be able to add a footer. My main problem is that I can add a button to the bottom of the drawer, but when screen is too small menu drawer items scroll behind that button. I want so that button moves along with those items and is always positioned at the bottom. I added Button to the navigation view and menu items separately in xml file.
Asked
Active
Viewed 160 times
0
-
Update question with xml file of yours. – twenk11k Mar 11 '19 at 09:17
2 Answers
0
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

Manohar
- 22,116
- 9
- 108
- 144
-
I just used scrollview with linearlayout and added elements inside of it. It worked like that. – Ive Vasiljević Mar 11 '19 at 12:20
0
Make header height and width matching the parent and in header layout you can customize all the content as you want.

bhagyawant biradar
- 215
- 1
- 9