这是我的固定页脚布局。包含 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
每当你创建 fix Footer 你的父级 Child Layout
你必须给 layout_above
属性到 Fix Footer 的高度意味着在你的情况下 LinearLayout
。高度以便在屏幕中显示 LinearLayout
父子 FrameLayout
你必须给 android:layout_above="@+id/linearLayout
..
关于android - 修复了android布局中的页脚,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39609000/