有如下两种样式:
style1:首部
style1:尾部:
style2:首部:
style2:尾部
第一种样式是头尾就是在头尾,开始看不到尾,往下滑倒底部才能看到,但同时头部也隐藏掉了,这我是采用最外层scrollview加内部的竖直方向linearlayout实现的,第二种样式是头尾固定,中间滑动不会影响头尾,这是最外层的relativelayout然后头部在上,设置id,让中间的recycleview在中间,设置高度wrap_content,设置button alignparrentbottom即可.
第二种样式的代码:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout 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:layout_width="match_parent"
android:orientation="vertical"
android:layout_height="match_parent"
tools:context=".activity.AddNewAccountActivity">
<include layout="@layout/include_tab"
android:id="@+id/lll"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"/>
<android.support.v7.widget.RecyclerView
android:id="@+id/rv_quanxianliebiao"
android:layout_below="@+id/lll"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
<Button
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_alignParentBottom="true"
android:text="@string/confirm_to_add_account"
android:background="@color/tab_red"
android:textColor="@color/white_fafafa"
android:textSize="20sp"
android:id="@+id/confirm_tobe_add"/>
</RelativeLayout>