【问题标题】:Android Drawer with RecyclerView add footer at bottom带有 RecyclerView 的 Android Drawer 在底部添加页脚
【发布时间】:2015-06-10 18:39:47
【问题描述】:

我正在尝试在菜单底部添加页脚(facebook 行)。

我正在为菜单中的项目使用带有回收器视图的抽屉。

我已经关注这个tuto,只是修改MyAdapter 来检测页脚并在这种情况下使用页脚布局 facebook 行。

我怎样才能将菜单的最后一项放在底部? 与this 相同,但具有回收站视图

【问题讨论】:

    标签: android navigation-drawer android-recyclerview


    【解决方案1】:

    像这样调整你的xml

    <?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>
    

    【讨论】:

      猜你喜欢
      • 2013-11-18
      • 1970-01-01
      • 2014-12-14
      • 1970-01-01
      • 2017-10-10
      • 2018-08-16
      • 2015-05-11
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多