RecycleView头ALL IN ONE(头+列表视图+页脚) [英] RecycleView Header all In One (header + listview + footer)

查看:246
本文介绍了RecycleView头ALL IN ONE(头+列表视图+页脚)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有我的头我想包括所有的问题,因为我想一个页脚是静态的。

我尝试在显示:


  • 屏幕显示3.7正确


  • 屏幕> 4.0显示不正确


在这里输入的形象描述

我的适配器(只放头充满页脚)

 如果(viewType == TYPE_HEADER){            视图V = LayoutInflater.from(parent.getContext())膨胀(R.layout.header,父母,假的)。 //充气布局            ViewHolder vhHeader =新ViewHolder(V,viewType,背景); //创建ViewHolder和传球类型视图的对象            返回vhHeader; //返回创建的对象
        }

我的XML Header.xml:

 < LinearLayout中的xmlns:机器人=htt​​p://schemas.android.com/apk/res/android
    的xmlns:工具=htt​​p://schemas.android.com/tool​​s的android:layout_width =match_parent
    机器人:layout_height =match_parent工具:上下文=com.onpocket.alcover.Fragment_0_6
    机器人:方向=垂直>    < - TODO:更新空白片段布局 - >    <的LinearLayout
        机器人:方向=垂直
        机器人:layout_width =match_parent
        机器人:layout_height =178dp>        <的LinearLayout
            机器人:方向=垂直
            机器人:layout_width =match_parent
            机器人:layout_height =match_parent
            机器人:layout_weight =1
            机器人:背景=@绘制/ contenedor_img_2_1_6_3
            机器人:ID =@ + ID / L1>            <的LinearLayout
                机器人:方向=垂直
                机器人:layout_width =match_parent
                机器人:layout_height =match_parent
                机器人:layout_weight =0.3>                < de.hdodenhof.circleimageview.CircleImageView
                    机器人:layout_width =70dp
                    机器人:layout_height =70dp
                    机器人:SRC =@绘制/ barra_lateral_img_0_1
                    机器人:layout_marginLeft =16DP
                    机器人:layout_marginTop =38dp
                    机器人:ID =@ + ID / circleView
                    机器人:adjustViewBounds =FALSE/>
            < / LinearLayout中>            <的LinearLayout
                机器人:方向=横向
                机器人:layout_width =match_parent
                机器人:layout_height =match_parent
                机器人:layout_weight =0.9
                机器人:背景=#af000000
                机器人:重力=center_vertical
                机器人:focusableInTouchMode =假
                机器人:ID =@ + ID / L3
                机器人:可聚焦=假>                <的LinearLayout
                    机器人:方向=横向
                    机器人:layout_width =15dp
                    机器人:layout_height =match_parent/>                <的LinearLayout
                    机器人:方向=垂直
                    机器人:layout_width =match_parent
                    机器人:layout_height =match_parent
                    机器人:重力=center_vertical>                    <的TextView
                        机器人:layout_width =WRAP_CONTENT
                        机器人:layout_height =WRAP_CONTENT
                        机器人:文字颜色=#FFFFFF
                        机器人:文本=TEXT
                        机器人:TEXTSIZE =14sp
                        机器人:文字样式=大胆
                        机器人:ID =@ + ID /名称/>                    <的TextView
                        机器人:layout_width =WRAP_CONTENT
                        机器人:layout_height =WRAP_CONTENT
                        机器人:文本=TEXT
                        机器人:ID =@ +帐号/电邮
                        机器人:文字颜色=#FFFFFFFF/>
                < / LinearLayout中>            < / LinearLayout中>        < / LinearLayout中>    < / LinearLayout中>    <的LinearLayout
        机器人:方向=垂直
        机器人:layout_width =match_parent
        机器人:layout_height =FILL_PARENT
        机器人:layout_weight =1>        <滚动型
            机器人:layout_width =match_parent
            机器人:layout_height =match_parent
            机器人:ID =@ + ID / scrollView2>            <的LinearLayout
                机器人:方向=垂直
                机器人:layout_width =match_parent
                机器人:layout_height =match_parent>                <的LinearLayout
                    机器人:方向=垂直
                    机器人:layout_width =match_parent
                    机器人:layout_height =match_parent
                    机器人:paddingTop =10dp>                    <的LinearLayout
                        机器人:方向=横向
                        机器人:layout_width =match_parent
                        机器人:layout_height =match_parent
                        机器人:重力=center_vertical>                        <的LinearLayout
                            机器人:方向=横向
                            机器人:layout_width =match_parent
                            机器人:layout_height =match_parent
                            机器人:layout_weight =1>                            <的LinearLayout
                                机器人:方向=横向
                                机器人:layout_width =match_parent
                                机器人:layout_height =match_parent
                                机器人:layout_weight =1/>                            <的LinearLayout
                                机器人:方向=横向
                                机器人:layout_width =match_parent
                                机器人:layout_height =match_parent
                                机器人:layout_weight =0.75>                                < ImageView的
                                    机器人:layout_width =WRAP_CONTENT
                                    机器人:layout_height =WRAP_CONTENT
                                    机器人:ID =@ + ID / imageView6
                                    机器人:SRC =@绘制/ barra_lateral_img_0_2
                                    机器人:adjustViewBounds =真/>
                            < / LinearLayout中>                            <的LinearLayout
                                机器人:方向=横向
                                机器人:layout_width =match_parent
                                机器人:layout_height =match_parent
                                机器人:layout_weight =1.3/>
                        < / LinearLayout中>                        <的LinearLayout
                            机器人:方向=横向
                            机器人:layout_width =match_parent
                            机器人:layout_height =match_parent
                            机器人:layout_weight =0.2
                            机器人:重力=center_vertical>                            <的TextView
                                机器人:layout_width =WRAP_CONTENT
                                机器人:layout_height =WRAP_CONTENT
                                机器人:textAppearance =机器人:ATTR / textAppearanceMedium
                                机器人:文字=@字符串/ lateral_inicio
                                机器人:ID =@ + ID / textView14
                                机器人:文字颜色=#010001/>
                        < / LinearLayout中>
                    < / LinearLayout中>                    <的LinearLayout
                        机器人:方向=垂直
                        机器人:layout_width =match_parent
                        机器人:layout_height =1DP
                        机器人:背景=@彩色/ color_0_0
                        机器人:layout_marginTop =10dp
                        机器人:layout_marginBottom =10dp/>
                < / LinearLayout中>                <的LinearLayout
                    机器人:方向=垂直
                    机器人:layout_width =match_parent
                    机器人:layout_height =match_parent
                    机器人:paddingTop =10dp>                    <的LinearLayout
                        机器人:方向=横向
                        机器人:layout_width =match_parent
                        机器人:layout_height =match_parent
                        机器人:重力=center_vertical>                        <的LinearLayout
                            机器人:方向=横向
                            机器人:layout_width =match_parent
                            机器人:layout_height =match_parent
                            机器人:layout_weight =1>                            <的LinearLayout
                                机器人:方向=横向
                                机器人:layout_width =match_parent
                                机器人:layout_height =match_parent
                                机器人:layout_weight =1/>                            <的LinearLayout
                                机器人:方向=横向
                                机器人:layout_width =match_parent
                                机器人:layout_height =match_parent
                                机器人:layout_weight =0.75>                                < ImageView的
                                    机器人:layout_width =WRAP_CONTENT
                                    机器人:layout_height =WRAP_CONTENT
                                    机器人:ID =@ + ID / imageView7
                                    机器人:SRC =@绘制/ barra_lateral_img_0_3
                                    机器人:adjustViewBounds =真/>
                            < / LinearLayout中>                            <的LinearLayout
                                机器人:方向=横向
                                机器人:layout_width =match_parent
                                机器人:layout_height =match_parent
                                机器人:layout_weight =1.3/>
                        < / LinearLayout中>                        <的LinearLayout
                            机器人:方向=横向
                            机器人:layout_width =match_parent
                            机器人:layout_height =match_parent
                            机器人:layout_weight =0.2
                            机器人:重力=center_vertical>                            <的TextView
                                机器人:layout_width =WRAP_CONTENT
                                机器人:layout_height =WRAP_CONTENT
                                机器人:textAppearance =机器人:ATTR / textAppearanceMedium
                                机器人:文字=@字符串/ lateral_idiomas
                                机器人:ID =@ + ID / textView15
                                机器人:文字颜色=#010001/>
                        < / LinearLayout中>
                    < / LinearLayout中>                    <的LinearLayout
                        机器人:方向=垂直
                        机器人:layout_width =match_parent
                        机器人:layout_height =1DP
                        机器人:背景=@彩色/ color_0_0
                        机器人:layout_marginTop =10dp
                        机器人:layout_marginBottom =10dp/>
                < / LinearLayout中>                <的LinearLayout
                    机器人:方向=垂直
                    机器人:layout_width =match_parent
                    机器人:layout_height =match_parent
                    机器人:paddingTop =10dp
                    机器人:paddingBottom会=8DP>                    <的LinearLayout
                        机器人:方向=横向
                        机器人:layout_width =match_parent
                        机器人:layout_height =match_parent
                        机器人:重力=center_vertical>                        <的LinearLayout
                            机器人:方向=横向
                            机器人:layout_width =match_parent
                            机器人:layout_height =match_parent
                            机器人:layout_weight =1>                            <的LinearLayout
                                机器人:方向=横向
                                机器人:layout_width =match_parent
                                机器人:layout_height =match_parent
                                机器人:layout_weight =1/>                            <的LinearLayout
                                机器人:方向=横向
                                机器人:layout_width =match_parent
                                机器人:layout_height =match_parent
                                机器人:layout_weight =0.75>                                < ImageView的
                                    机器人:layout_width =WRAP_CONTENT
                                    机器人:layout_height =WRAP_CONTENT
                                    机器人:ID =@ + ID / imageView8
                                    机器人:SRC =@绘制/ barra_lateral_img_0_4
                                    机器人:adjustViewBounds =真/>
                            < / LinearLayout中>                            <的LinearLayout
                                机器人:方向=横向
                                机器人:layout_width =match_parent
                                机器人:layout_height =match_parent
                                机器人:layout_weight =1.3/>
                        < / LinearLayout中>                        <的LinearLayout
                            机器人:方向=横向
                            机器人:layout_width =match_parent
                            机器人:layout_height =match_parent
                            机器人:layout_weight =0.2
                            机器人:重力=center_vertical>                            <的TextView
                                机器人:layout_width =WRAP_CONTENT
                                机器人:layout_height =WRAP_CONTENT
                                机器人:textAppearance =机器人:ATTR / textAppearanceMedium
                                机器人:文字=@字符串/ lateral_contacto
                                机器人:ID =@ + ID / textView16
                                机器人:文字颜色=#010001/>
                        < / LinearLayout中>
                    < / LinearLayout中>                    <的LinearLayout
                        机器人:方向=垂直
                        机器人:layout_width =match_parent
                        机器人:layout_height =1DP
                        机器人:背景=@彩色/ color_0_0
                        机器人:layout_marginTop =10dp
                        机器人:layout_marginBottom =10dp/>
                < / LinearLayout中>                <的LinearLayout
                    机器人:方向=垂直
                    机器人:layout_width =match_parent
                    机器人:layout_height =match_parent
                    机器人:paddingTop =10dp
                    机器人:paddingBottom会=8DP>                    <的LinearLayout
                        机器人:方向=横向
                        机器人:layout_width =match_parent
                        机器人:layout_height =match_parent
                        机器人:重力=center_vertical>                        <的LinearLayout
                            机器人:方向=横向
                            机器人:layout_width =match_parent
                            机器人:layout_height =match_parent
                            机器人:layout_weight =1>                            <的LinearLayout
                                机器人:方向=横向
                                机器人:layout_width =match_parent
                                机器人:layout_height =match_parent
                                机器人:layout_weight =1/>                            <的LinearLayout
                                机器人:方向=横向
                                机器人:layout_width =match_parent
                                机器人:layout_height =match_parent
                                机器人:layout_weight =0.75>                                < ImageView的
                                    机器人:layout_width =WRAP_CONTENT
                                    机器人:layout_height =WRAP_CONTENT
                                    机器人:ID =@ + ID / imageView9
                                    机器人:SRC =@绘制/ barra_lateral_img_0_5
                                    机器人:adjustViewBounds =真/>
                            < / LinearLayout中>                            <的LinearLayout
                                机器人:方向=横向
                                机器人:layout_width =match_parent
                                机器人:layout_height =match_parent
                                机器人:layout_weight =1.3/>
                        < / LinearLayout中>                        <的LinearLayout
                            机器人:方向=横向
                            机器人:layout_width =match_parent
                            机器人:layout_height =match_parent
                            机器人:layout_weight =0.2
                            机器人:重力=center_vertical>                            <的TextView
                                机器人:layout_width =WRAP_CONTENT
                                机器人:layout_height =WRAP_CONTENT
                                机器人:textAppearance =机器人:ATTR / textAppearanceMedium
                                机器人:文字=@字符串/ lateral_notificaciones
                                机器人:ID =@ + ID / textView17
                                机器人:文字颜色=#010001/>
                        < / LinearLayout中>
                    < / LinearLayout中>                    <的LinearLayout
                        机器人:方向=垂直
                        机器人:layout_width =match_parent
                        机器人:layout_height =1DP
                        机器人:背景=@彩色/ color_0_0
                        机器人:layout_marginTop =10dp
                        机器人:layout_marginBottom =10dp/>
                < / LinearLayout中>
            < / LinearLayout中>
        < /滚动型>
    < / LinearLayout中>    <的LinearLayout
        机器人:方向=垂直
        机器人:layout_width =match_parent
        机器人:layout_height =WRAP_CONTENT>        <的LinearLayout
            机器人:方向=垂直
            机器人:layout_width =match_parent
            机器人:layout_height =1DP
            机器人:背景=@彩色/ color_0_0
            机器人:layout_marginBottom =10dp/>        <的LinearLayout
            机器人:方向=横向
            机器人:layout_width =FILL_PARENT
            机器人:layout_height =60dp
            机器人:ID =@ + ID / linearLayout10>            <的LinearLayout
                机器人:方向=横向
                机器人:layout_width =10dp
                机器人:layout_height =match_parent>< / LinearLayout中>            <的ImageButton
                机器人:layout_width =32dp
                机器人:layout_height =WRAP_CONTENT
                机器人:ID =@ + ID / imageButton6
                机器人:SRC =@绘制/ barra_lateral_img_0_6
                机器人:layout_weight =1
                机器人:背景=@空
                机器人:scaleType =fitCenter
                机器人:layout_margin =12dp
                机器人:标签=脸谱
                安卓的onClick =选择信息/>            <的ImageButton
                机器人:layout_width =32dp
                机器人:layout_height =WRAP_CONTENT
                机器人:ID =@ + ID / imageButton7
                机器人:SRC =@绘制/ barra_lateral_img_0_7
                机器人:layout_weight =1
                机器人:背景=@空
                机器人:scaleType =fitCenter
                机器人:layout_margin =12dp
                机器人:标签=推特
                安卓的onClick =选择信息/>            <的ImageButton
                机器人:layout_width =32dp
                机器人:layout_height =WRAP_CONTENT
                机器人:ID =@ + ID / imageButton8
                机器人:SRC =@绘制/ barra_lateral_img_0_8
                机器人:layout_weight =1
                机器人:背景=@空
                机器人:scaleType =fitCenter
                机器人:layout_margin =12dp
                机器人:标签=LinkedIn
                安卓的onClick =选择信息/>            <的ImageButton
                机器人:layout_width =32dp
                机器人:layout_height =WRAP_CONTENT
                机器人:ID =@ + ID / imageButton9
                机器人:SRC =@绘制/ barra_lateral_img_0_9
                机器人:layout_weight =1
                机器人:背景=@空
                机器人:scaleType =fitCenter
                机器人:layout_margin =12dp
                机器人:标签=博客
                安卓的onClick =选择信息/>            <的ImageButton
                机器人:layout_width =36dp
                机器人:layout_height =WRAP_CONTENT
                机器人:ID =@ + ID / imageButton10
                机器人:layout_weight =1
                机器人:背景=@空
                机器人:scaleType =fitCenter
                机器人:layout_margin =5DP
                机器人:标签=YouTube的视频
                安卓的onClick =选择信息/>
        < / LinearLayout中>
    < / LinearLayout中>< / LinearLayout中>
    <! -
    < XML版本=1.0编码=UTF-8&GT?;    <的RelativeLayout的xmlns:机器人=htt​​p://schemas.android.com/apk/res/android
        机器人:layout_width =match_parent
        机器人:layout_height =178dp
        机器人:方向=垂直
        机器人:weightSum =1
        机器人:背景=@绘制/ contenedor_img_2_1_6_3机器人:scaleType =centerCrop>        <的LinearLayout
            机器人:layout_width =match_parent
            机器人:layout_height =56dp
            机器人:方向=垂直
            机器人:layout_alignParentBottom =真
            机器人:layout_alignParentLeft =假
            机器人:layout_alignParentStart =真
            机器人:背景=@色/不透明度
            机器人:重力=center_vertical>            <的TextView
                机器人:ID =@ + ID /名称
                机器人:layout_width =WRAP_CONTENT
                机器人:layout_height =WRAP_CONTENT
                机器人:layout_marginLeft =16DP
                机器人:文字颜色=#FFFFFF
                机器人:文字=阿卡什Bangad
                机器人:TEXTSIZE =14sp
                机器人:文字样式=大胆
                />    &放大器; LT;!&安培; ndash的;机器人:背景=#7f000000
            机器人:单线=假
            机器人:paddingLeft =5DP
            机器人:paddingTop =5DP
            机器人:paddingRight =15dp
            机器人:paddingBottom会=5DP&放大器; ndash的;&放大器; GT;            <的TextView
                机器人:ID =@ +帐号/电邮
                机器人:layout_width =WRAP_CONTENT
                机器人:layout_height =WRAP_CONTENT
                机器人:文字=inicio_texto_em preSA
                机器人:文字颜色=#FFFFFFFF
                机器人:layout_marginLeft =16DP
               />
        < / LinearLayout中>        < de.hdodenhof.circleimageview.CircleImageView
            机器人:layout_width =70dp
            机器人:layout_height =70dp
            机器人:SRC =@绘制/ barra_lateral_img_0_1
            机器人:layout_marginLeft =16DP
            机器人:layout_marginTop =38dp
            机器人:ID =@ + ID / circleView
            机器人:adjustViewBounds =FALSE/>
    &所述; / RelativeLayout的&GT - →;


解决方案

尝试到中间的LinearLayout的权重设置为1,其高度0dp。因此,只有你的页眉和页脚有一个固定的高度和滚动视图将利用剩余的空间。

I have problem with my Header I want include all, because I want a footer static.

I try show in :

  • screens 3.7 show correctly

  • Screen > 4.0 show incorrectly

My adapter (Only put header full with footer)

   if (viewType == TYPE_HEADER) {

            View v = LayoutInflater.from(parent.getContext()).inflate(R.layout.header,parent,false); //Inflating the layout

            ViewHolder vhHeader = new ViewHolder(v,viewType,context); //Creating ViewHolder and passing the object of type view

            return vhHeader; //returning the object created


        }

My XML Header.xml :

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"
    android:layout_height="match_parent" tools:context="com.onpocket.alcover.Fragment_0_6"
    android:orientation="vertical">

    <!-- TODO: Update blank fragment layout -->

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

        <LinearLayout
            android:orientation="vertical"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_weight="1"
            android:background="@drawable/contenedor_img_2_1_6_3"
            android:id="@+id/l1">

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

                <de.hdodenhof.circleimageview.CircleImageView
                    android:layout_width="70dp"
                    android:layout_height="70dp"
                    android:src="@drawable/barra_lateral_img_0_1"
                    android:layout_marginLeft="16dp"
                    android:layout_marginTop="38dp"
                    android:id="@+id/circleView"
                    android:adjustViewBounds="false" />
            </LinearLayout>

            <LinearLayout
                android:orientation="horizontal"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:layout_weight="0.9"
                android:background="#af000000"
                android:gravity="center_vertical"
                android:focusableInTouchMode="false"
                android:id="@+id/l3"
                android:focusable="false">

                <LinearLayout
                    android:orientation="horizontal"
                    android:layout_width="15dp"
                    android:layout_height="match_parent" />

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

                    <TextView
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:textColor="#ffffff"
                        android:text="text"
                        android:textSize="14sp"
                        android:textStyle="bold"
                        android:id="@+id/name"/>

                    <TextView
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="text"
                        android:id="@+id/email"
                        android:textColor="#ffffffff" />
                </LinearLayout>

            </LinearLayout>

        </LinearLayout>

    </LinearLayout>

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

        <ScrollView
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:id="@+id/scrollView2" >

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

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

                    <LinearLayout
                        android:orientation="horizontal"
                        android:layout_width="match_parent"
                        android:layout_height="match_parent"
                        android:gravity="center_vertical" >

                        <LinearLayout
                            android:orientation="horizontal"
                            android:layout_width="match_parent"
                            android:layout_height="match_parent"
                            android:layout_weight="1" >

                            <LinearLayout
                                android:orientation="horizontal"
                                android:layout_width="match_parent"
                                android:layout_height="match_parent"
                                android:layout_weight="1" />

                            <LinearLayout
                                android:orientation="horizontal"
                                android:layout_width="match_parent"
                                android:layout_height="match_parent"
                                android:layout_weight="0.75" >

                                <ImageView
                                    android:layout_width="wrap_content"
                                    android:layout_height="wrap_content"
                                    android:id="@+id/imageView6"
                                    android:src="@drawable/barra_lateral_img_0_2"
                                    android:adjustViewBounds="true" />
                            </LinearLayout>

                            <LinearLayout
                                android:orientation="horizontal"
                                android:layout_width="match_parent"
                                android:layout_height="match_parent"
                                android:layout_weight="1.3" />
                        </LinearLayout>

                        <LinearLayout
                            android:orientation="horizontal"
                            android:layout_width="match_parent"
                            android:layout_height="match_parent"
                            android:layout_weight="0.2"
                            android:gravity="center_vertical" >

                            <TextView
                                android:layout_width="wrap_content"
                                android:layout_height="wrap_content"
                                android:textAppearance="?android:attr/textAppearanceMedium"
                                android:text="@string/lateral_inicio"
                                android:id="@+id/textView14"
                                android:textColor="#010001" />
                        </LinearLayout>
                    </LinearLayout>

                    <LinearLayout
                        android:orientation="vertical"
                        android:layout_width="match_parent"
                        android:layout_height="1dp"
                        android:background="@color/color_0_0"
                        android:layout_marginTop="10dp"
                        android:layout_marginBottom="10dp" />
                </LinearLayout>

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

                    <LinearLayout
                        android:orientation="horizontal"
                        android:layout_width="match_parent"
                        android:layout_height="match_parent"
                        android:gravity="center_vertical" >

                        <LinearLayout
                            android:orientation="horizontal"
                            android:layout_width="match_parent"
                            android:layout_height="match_parent"
                            android:layout_weight="1" >

                            <LinearLayout
                                android:orientation="horizontal"
                                android:layout_width="match_parent"
                                android:layout_height="match_parent"
                                android:layout_weight="1" />

                            <LinearLayout
                                android:orientation="horizontal"
                                android:layout_width="match_parent"
                                android:layout_height="match_parent"
                                android:layout_weight="0.75" >

                                <ImageView
                                    android:layout_width="wrap_content"
                                    android:layout_height="wrap_content"
                                    android:id="@+id/imageView7"
                                    android:src="@drawable/barra_lateral_img_0_3"
                                    android:adjustViewBounds="true" />
                            </LinearLayout>

                            <LinearLayout
                                android:orientation="horizontal"
                                android:layout_width="match_parent"
                                android:layout_height="match_parent"
                                android:layout_weight="1.3" />
                        </LinearLayout>

                        <LinearLayout
                            android:orientation="horizontal"
                            android:layout_width="match_parent"
                            android:layout_height="match_parent"
                            android:layout_weight="0.2"
                            android:gravity="center_vertical" >

                            <TextView
                                android:layout_width="wrap_content"
                                android:layout_height="wrap_content"
                                android:textAppearance="?android:attr/textAppearanceMedium"
                                android:text="@string/lateral_idiomas"
                                android:id="@+id/textView15"
                                android:textColor="#010001" />
                        </LinearLayout>
                    </LinearLayout>

                    <LinearLayout
                        android:orientation="vertical"
                        android:layout_width="match_parent"
                        android:layout_height="1dp"
                        android:background="@color/color_0_0"
                        android:layout_marginTop="10dp"
                        android:layout_marginBottom="10dp" />
                </LinearLayout>

                <LinearLayout
                    android:orientation="vertical"
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:paddingTop="10dp"
                    android:paddingBottom="8dp" >

                    <LinearLayout
                        android:orientation="horizontal"
                        android:layout_width="match_parent"
                        android:layout_height="match_parent"
                        android:gravity="center_vertical" >

                        <LinearLayout
                            android:orientation="horizontal"
                            android:layout_width="match_parent"
                            android:layout_height="match_parent"
                            android:layout_weight="1" >

                            <LinearLayout
                                android:orientation="horizontal"
                                android:layout_width="match_parent"
                                android:layout_height="match_parent"
                                android:layout_weight="1" />

                            <LinearLayout
                                android:orientation="horizontal"
                                android:layout_width="match_parent"
                                android:layout_height="match_parent"
                                android:layout_weight="0.75" >

                                <ImageView
                                    android:layout_width="wrap_content"
                                    android:layout_height="wrap_content"
                                    android:id="@+id/imageView8"
                                    android:src="@drawable/barra_lateral_img_0_4"
                                    android:adjustViewBounds="true" />
                            </LinearLayout>

                            <LinearLayout
                                android:orientation="horizontal"
                                android:layout_width="match_parent"
                                android:layout_height="match_parent"
                                android:layout_weight="1.3" />
                        </LinearLayout>

                        <LinearLayout
                            android:orientation="horizontal"
                            android:layout_width="match_parent"
                            android:layout_height="match_parent"
                            android:layout_weight="0.2"
                            android:gravity="center_vertical" >

                            <TextView
                                android:layout_width="wrap_content"
                                android:layout_height="wrap_content"
                                android:textAppearance="?android:attr/textAppearanceMedium"
                                android:text="@string/lateral_contacto"
                                android:id="@+id/textView16"
                                android:textColor="#010001" />
                        </LinearLayout>
                    </LinearLayout>

                    <LinearLayout
                        android:orientation="vertical"
                        android:layout_width="match_parent"
                        android:layout_height="1dp"
                        android:background="@color/color_0_0"
                        android:layout_marginTop="10dp"
                        android:layout_marginBottom="10dp" />
                </LinearLayout>

                <LinearLayout
                    android:orientation="vertical"
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:paddingTop="10dp"
                    android:paddingBottom="8dp" >

                    <LinearLayout
                        android:orientation="horizontal"
                        android:layout_width="match_parent"
                        android:layout_height="match_parent"
                        android:gravity="center_vertical" >

                        <LinearLayout
                            android:orientation="horizontal"
                            android:layout_width="match_parent"
                            android:layout_height="match_parent"
                            android:layout_weight="1" >

                            <LinearLayout
                                android:orientation="horizontal"
                                android:layout_width="match_parent"
                                android:layout_height="match_parent"
                                android:layout_weight="1" />

                            <LinearLayout
                                android:orientation="horizontal"
                                android:layout_width="match_parent"
                                android:layout_height="match_parent"
                                android:layout_weight="0.75" >

                                <ImageView
                                    android:layout_width="wrap_content"
                                    android:layout_height="wrap_content"
                                    android:id="@+id/imageView9"
                                    android:src="@drawable/barra_lateral_img_0_5"
                                    android:adjustViewBounds="true" />
                            </LinearLayout>

                            <LinearLayout
                                android:orientation="horizontal"
                                android:layout_width="match_parent"
                                android:layout_height="match_parent"
                                android:layout_weight="1.3" />
                        </LinearLayout>

                        <LinearLayout
                            android:orientation="horizontal"
                            android:layout_width="match_parent"
                            android:layout_height="match_parent"
                            android:layout_weight="0.2"
                            android:gravity="center_vertical" >

                            <TextView
                                android:layout_width="wrap_content"
                                android:layout_height="wrap_content"
                                android:textAppearance="?android:attr/textAppearanceMedium"
                                android:text="@string/lateral_notificaciones"
                                android:id="@+id/textView17"
                                android:textColor="#010001" />
                        </LinearLayout>
                    </LinearLayout>

                    <LinearLayout
                        android:orientation="vertical"
                        android:layout_width="match_parent"
                        android:layout_height="1dp"
                        android:background="@color/color_0_0"
                        android:layout_marginTop="10dp"
                        android:layout_marginBottom="10dp" />
                </LinearLayout>
            </LinearLayout>
        </ScrollView>
    </LinearLayout>

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

        <LinearLayout
            android:orientation="vertical"
            android:layout_width="match_parent"
            android:layout_height="1dp"
            android:background="@color/color_0_0"
            android:layout_marginBottom="10dp" />

        <LinearLayout
            android:orientation="horizontal"
            android:layout_width="fill_parent"
            android:layout_height="60dp"
            android:id="@+id/linearLayout10" >

            <LinearLayout
                android:orientation="horizontal"
                android:layout_width="10dp"
                android:layout_height="match_parent"></LinearLayout>

            <ImageButton
                android:layout_width="32dp"
                android:layout_height="wrap_content"
                android:id="@+id/imageButton6"
                android:src="@drawable/barra_lateral_img_0_6"
                android:layout_weight="1"
                android:background="@null"
                android:scaleType="fitCenter"
                android:layout_margin="12dp"
                android:tag="facebook"
                android:onClick="selectItem" />

            <ImageButton
                android:layout_width="32dp"
                android:layout_height="wrap_content"
                android:id="@+id/imageButton7"
                android:src="@drawable/barra_lateral_img_0_7"
                android:layout_weight="1"
                android:background="@null"
                android:scaleType="fitCenter"
                android:layout_margin="12dp"
                android:tag="twitter"
                android:onClick="selectItem" />

            <ImageButton
                android:layout_width="32dp"
                android:layout_height="wrap_content"
                android:id="@+id/imageButton8"
                android:src="@drawable/barra_lateral_img_0_8"
                android:layout_weight="1"
                android:background="@null"
                android:scaleType="fitCenter"
                android:layout_margin="12dp"
                android:tag="linkedin"
                android:onClick="selectItem" />

            <ImageButton
                android:layout_width="32dp"
                android:layout_height="wrap_content"
                android:id="@+id/imageButton9"
                android:src="@drawable/barra_lateral_img_0_9"
                android:layout_weight="1"
                android:background="@null"
                android:scaleType="fitCenter"
                android:layout_margin="12dp"
                android:tag="blog"
                android:onClick="selectItem" />

            <ImageButton
                android:layout_width="36dp"
                android:layout_height="wrap_content"
                android:id="@+id/imageButton10"
                android:layout_weight="1"
                android:background="@null"
                android:scaleType="fitCenter"
                android:layout_margin="5dp"
                android:tag="youtube"
                android:onClick="selectItem" />
        </LinearLayout>
    </LinearLayout>

</LinearLayout>


    <!--
    <?xml version="1.0" encoding="utf-8"?>

    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="match_parent"
        android:layout_height="178dp"
        android:orientation="vertical"
        android:weightSum="1"
        android:background="@drawable/contenedor_img_2_1_6_3" android:scaleType="centerCrop">



        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="56dp"
            android:orientation="vertical"
            android:layout_alignParentBottom="true"
            android:layout_alignParentLeft="false"
            android:layout_alignParentStart="true"
            android:background="@color/opacity"
            android:gravity="center_vertical">

            <TextView
                android:id="@+id/name"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginLeft="16dp"
                android:textColor="#ffffff"
                android:text="Akash Bangad"
                android:textSize="14sp"
                android:textStyle="bold"


                />

    &lt;!&ndash;        android:background="#7f000000"
            android:singleLine="false"
            android:paddingLeft="5dp"
            android:paddingTop="5dp"
            android:paddingRight="15dp"
            android:paddingBottom="5dp"&ndash;&gt;

            <TextView
                android:id="@+id/email"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="inicio_texto_empresa"
                android:textColor="#ffffffff"
                android:layout_marginLeft="16dp"
               />
        </LinearLayout>

        <de.hdodenhof.circleimageview.CircleImageView
            android:layout_width="70dp"
            android:layout_height="70dp"
            android:src="@drawable/barra_lateral_img_0_1"
            android:layout_marginLeft="16dp"
            android:layout_marginTop="38dp"
            android:id="@+id/circleView"
            android:adjustViewBounds="false" />
    </RelativeLayout>-->

解决方案

Try to set the weight of the middle Linearlayout to 1 and its height to 0dp. So only your header and your footer have a fixed height and the scrollview will use the remaining space.

这篇关于RecycleView头ALL IN ONE(头+列表视图+页脚)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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