Android的抽屉与RecyclerView在底部添加脚注 [英] Android Drawer with RecyclerView add footer at bottom

查看:777
本文介绍了Android的抽屉与RecyclerView在底部添加脚注的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在我的菜单(脸谱线)的底部添加脚注。

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.

我必须遵循这个政党成员,只是mod MyAdapter 来检测这种情况下,Facebook的行页脚和页脚使用布局。

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

我怎么能有菜单的底部的最后一个项目?
同<一个href=\"http://stackoverflow.com/questions/19156476/how-to-put-list-items-at-the-bottom-of-list-view-in-navigation-drawer-like-fours\">this但鉴于回收

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

推荐答案

只是调整这样的XML

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>

这篇关于Android的抽屉与RecyclerView在底部添加脚注的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆