Kingstone59
Kingstone59

Reputation: 193

Android Drawer with RecyclerView add footer at bottom

I'm trying to add footer at the bottom of my menu (facebook line).

I'm using drawer with recycler view for items in menu.

I have follow this tuto, just mod MyAdapter to detect footer and using footer layout in this case facebook line.

How can I have the last item of menu at bottom ? Same as this but with recycler view

Menu

Upvotes: 1

Views: 1710

Answers (1)

Kingstone59
Kingstone59

Reputation: 193

Just adjust your xml like this

<?xml version="1.0" encoding="utf-8"?>
 <android.support.v4.widget.DrawerLayout  xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/drawer_layout_menu"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/grey_dark_menu"
android:elevation="7dp" >

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical" >

    <include
        android:id="@+id/tool_bar"
        layout="@layout/tool_bar" >
    </include>

    <FrameLayout
        android:id="@+id/main"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="#ffffff" />
</LinearLayout>

<RelativeLayout
    android:layout_width="320dp"
    android:layout_height="match_parent"
    android:layout_gravity="start" >

    <android.support.v7.widget.RecyclerView
        android:id="@+id/RecyclerView"
        android:layout_width="320dp"
        android:layout_height="match_parent"
        android:layout_gravity="start"
        android:background="@color/grey_dark_menu"
        android:scrollbars="vertical" >
    </android.support.v7.widget.RecyclerView>

    <LinearLayout
        android:id="@+id/footer_menu_facebook"
        android:layout_width="320dp"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:background="#508bc3"
        android:orientation="horizontal"
        android:padding="3dp" >

        <ImageView
            android:id="@+id/rowIcon"
            android:layout_width="34dp"
            android:layout_height="34dp"
            android:layout_gravity="center_vertical"
            android:layout_margin="5dp"
            android:src="@drawable/menu_facebook" />

        <TextView
            android:id="@+id/rowText"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center_vertical"
            android:layout_margin="5dp"
            android:text="@string/footer_menu_facebook"
            android:textColor="@android:color/white"
            android:textSize="18sp" />
    </LinearLayout>
</RelativeLayout>

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

Upvotes: 5

Related Questions