android - Android 我的底部应用程序栏与我的回收站视图重叠
问题描述
我正在尝试解决我的 recyclerview 与 bottomappbar 重叠的问题。这是我的布局代码。
<androidx.coordinatorlayout.widget.CoordinatorLayout
android:id="@+id/notes_container_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="40dp"
android:padding="8dp"
android:text="@string/myTasksHeader"
android:textColor="@color/appBarTextColor"
android:textSize="40dp" />
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerview"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clipToPadding="false"
android:padding="16dp"
android:scrollbars="none"
tools:listitem="@layout/note_list_item" />
</ScrollView>
</LinearLayout>
<com.google.android.material.bottomappbar.BottomAppBar
android:id="@+id/bottomAppBar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:backgroundTint="@color/colorPrimary"
app:hideOnScroll="false"
app:menu="@menu/appbar_menu"
app:navigationIcon="@drawable/ic_menu" />
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/add_note_fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="@dimen/medium_margin"
android:backgroundTint="@color/colorPrimary"
app:layout_anchor="@id/bottomAppBar"
app:srcCompat="@drawable/ic_add_black_24dp"
tools:ignore="VectorDrawableCompat" />
</androidx.coordinatorlayout.widget.CoordinatorLayout>
当我填写清单时,我无法到达回收站视图中的最后一项。我尝试添加边距,但没有奏效。
解决方案
使用边距的问题是 RecyclerView 不会通过 FAB 显示。比使用边距更好的解决方案是使用填充在 RecyclerView 底部添加额外空间。
android:clipToPadding="false"
android:paddingBottom="?actionBarSize"
推荐阅读
- javascript - 如果 api 中没有更多信息,如何删除按钮
- python - 如何获取异常参数?
- java - 无法检索更新的布尔数据或在领域数据库中正确更新它
- php - PHP 7.1.14 APCu 在 Mac OSX High Sierra 中不工作
- python - 获取命令的退出代码
- java - Hibernate TableGenerator.getNextValue 在当前事务上调用挂起
- java - 通过 servlet/java 从 ajax 调用从 ftp 位置下载多个文件
- regex - 正则表达式匹配大于十进制值的数字
- php - WordPress中@opendir中的@字符有什么用
- r - 错误:“闪亮”的包或命名空间加载失败:部署闪亮的应用程序时