android - 修复了android布局中的页脚

标签 android android-layout android-fragments footer

这是我的固定页脚布局。包含 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 每当你创建 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/

相关文章:

Android 创建多个 fragment 或更好的方法?

php - 登录系统: $_POST ['username' ] and $_POST ['password' ] are always empty

java.util.zip.ZipException : duplicate entry?

android - 如何在微调器中添加默认文本?

android - 你能用我的代码找出错误吗?

android - 在方向更改时更改 RecyclerView 布局仅适用于第一个 View

java - 如何在RecyclerView中选择单个项目?

android - 如何更改 ImageView 中图像的颜色?

java - Android:如果 EditText 在 x 秒内未更改,则调用函数

ios - 相当于 iOS 中的 Fragment (Android)