簡體   English   中英

在Android布局中固定頁腳

[英]Fixed footer in android layout

這是我的固定頁腳布局。 包含RecyclerViewFragment附加到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>

在你的FrameLayout給出屬性

android:layout_above="@+id/footer_linearlayout"

它將顯示FrameLayoutFooter

添加這種方式:

<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_above屬性賦予Fix Footer的高度意味着在你的情況下LinearLayout 高度所以要在屏幕上顯示LinearLayout父Child FrameLayout你必須給android:layout_above="@+id/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="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>

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM