Android实现此头尾部固定中间滑动样式布局

有如下两种样式:
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>


  • 0
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值