android-layout - 覆盖最后一个 RecyclerView 项目的持久底部表偷看
问题描述
我在我的布局中实现了一个持久的底页——它不能完全隐藏,但总是从底部偷看。 但它涵盖了最后一个 RecyclerView 项目。 如何设置布局以使 peek 不会隐藏最后一项?
截屏:-
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.design.widget.CoordinatorLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.v4.widget.NestedScrollView
android:id="@+id/nestedScrollView"
android:layout_width="match_parent"
android:layout_height="match_parent">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.v7.widget.RecyclerView
android:id="@+id/recylerView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_weight="1" />
</RelativeLayout>
</android.support.v4.widget.NestedScrollView>
<!-- Buttom Sheet -->
<android.support.v7.widget.LinearLayoutCompat
android:id="@+id/bottom_sheet"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@android:color/white"
android:orientation="vertical"
app:behavior_hideable="true"
app:behavior_peekHeight="56dp"
app:layout_behavior="android.support.design.widget.BottomSheetBehavior">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="56dp"
android:layout_gravity="center_vertical"
android:background="@android:color/holo_green_dark"
android:orientation="horizontal"
android:padding="10dp"
android:weightSum="3">
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:layout_weight="2"
android:text="Submit Report"/>
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="right"
android:text="8/10"/>
</LinearLayout>
<!-- Other things to add -->
</android.support.v7.widget.LinearLayoutCompat>
</android.support.design.widget.CoordinatorLayout>
</FrameLayout>
解决方案
这很愚蠢。发布问题后,我自己就知道了解决方案。:) 只需将android:paddingBottom属性添加到 RecyclerView。
<android.support.v7.widget.RecyclerView
android:id="@+id/studentListView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingBottom="56dp"/>
推荐阅读
- hibernate - Hibernate - 是否有可能与 createEntityManager 一起等待免费连接
- docker - 如何在一个阶段运行命令并将结果用于另一个阶段?
- javascript - 将显示的值更改为名称
- r - 用另一列的信息填充NA
- mysql - 数 GB 大小的 innodb 数据文件
- scala - scala.util.Try 块的返回值
- html - Bootstrap 手风琴仅适用于 4 上的 2 个项目
- python - .only().prefetch_related() 给出 'ManyToOneRel' 对象没有属性 'attname'
- excel - 显示滚动时组合框有问题
- c# - 使用 Predicate Builder 的表达式太长