android布局中的固定页脚

android布局中的固定页脚,android,android-layout,android-fragments,footer,Android,Android Layout,Android Fragments,Footer,这是我的固定页脚布局。包含RecyclerView的片段附加到FrameLayout。但是,RecyclerView的内容被页脚布局重叠 <RelativeLayout android:layout_height="match_parent" android:layout_width="match_parent" android:orientation="vertical"> <FrameLayout android:id="@+id/home_parent_fra

这是我的固定页脚布局。包含
RecyclerView
片段
附加到
FrameLayout
。但是,
RecyclerView
的内容被页脚布局重叠

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

<FrameLayout
    android:id="@+id/home_parent_framelayout"
    android:layout_height="wrap_content"
    android:layout_width="match_parent"
    app:layout_behavior="@string/appbar_scrolling_view_behavior" />

<LinearLayout
    android:id="@+id/footer_linearlayout"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="horizontal"
    android:background="#f1c21e"
    android:layout_alignParentBottom="true">

    <footer layout>

    </LinearLayout>

</RelativeLayout>

试试这个:

<?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="match_parent">

    <FrameLayout
        android:id="@+id/home_parent_framelayout"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        app:layout_behavior="@string/appbar_scrolling_view_behavior"
        android:layout_above="@+id/footer_linearlayout" />

    <LinearLayout
        android:id="@+id/footer_linearlayout"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:background="#f1c21e"
        android:orientation="horizontal">

//Your footer layout
    </LinearLayout>

</RelativeLayout>

//页脚布局

在您的
框架布局中
给定属性

android:layout_above="@+id/footer_linearlayout"
它将同时显示
FrameLayout
Footer

这样添加:

<FrameLayout
    android:id="@+id/home_parent_framelayout"
    android:layout_height="wrap_content"
    android:layout_width="match_parent"
    app:layout_behavior="@string/appbar_scrolling_view_behavior"
    android:layout_above="@+id/footer_linearlayout" />

说明:


无论何时创建固定页脚时,您的
LinearLayout
都不会显示
Bottom
,您的父子
Layout
必须将上述
Layout\u属性指定给您的情况下的
LinearLayout
固定页脚的高度。高度,以便在屏幕中显示父级子级
FrameLayout
必须在上面给出
android:layout_=“@+id/LinearLayout

FrameLayout的高度作为包装内容,因此当我添加android:layout_=“@+id/footer\u LinearLayout”时“framelayout布局显示在页脚上方,但由于其具有高度换行内容,因此在其上方(framelayout)留下大量空白。然后将
framelayout
高度指定给
match\u parent
,则需要将整个高度指定给
framelayout
。这会解决你的问题。@Androidjack很高兴帮助你。