[英]Fixed footer in android layout
這是我的固定頁腳布局。 包含RecyclerView
的Fragment
附加到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"
它將顯示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_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.