android - 为什么在协调器布局的底部修复按钮在android中使用回收视图滚动
问题描述
我想在底部有一个回收视图和一个修复按钮。我使用协调器布局,一切正常,但是当回收视图滚动结束时,修复按钮会随着回收视图移动一点。问题是什么??
这是我的代码..
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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:background="@drawable/filter_frame"
android:orientation="vertical">
<androidx.coordinatorlayout.widget.CoordinatorLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/shopsList"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_above="@id/complete_info_order"
android:layout_marginBottom="@dimen/_70sdp"
android:orientation="vertical"
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
<Button
android:id="@+id/complete_info_order"
android:layout_width="match_parent"
android:layout_height="@dimen/_40sdp"
android:layout_alignParentBottom="true"
android:layout_gravity="bottom"
android:layout_marginLeft="@dimen/_20sdp"
android:layout_marginTop="@dimen/_30sdp"
android:layout_marginRight="@dimen/_20sdp"
android:layout_marginBottom="@dimen/_60sdp"
android:background="@drawable/login_button_frame"
android:gravity="center"/>
</androidx.coordinatorlayout.widget.CoordinatorLayout>
我应该怎么做才能使按钮不随回收视图移动?
非常感谢...
解决方案
试试这个:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.v7.widget.RecyclerView
android:id="@+id/shopsList"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
<Button
android:id="@+id/complete_info_order"
android:text="Button"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_width="wrap_content"
android:layout_height="40dp"/>
</RelativeLayout>
推荐阅读
- ios - 如何从 NSPersistentHistoryChange 中判断对象类型
- c - Linux驱动编写,file_operations不兼容的指针类型错误
- php - 在 Laravel 中选择图像部分
- google-apps-script - 如何在目标文件夹中创建工作表副本
- user-interface - 如何添加用户以用户身份而不是 root Yocto 项目 sama5d27 板登录
- python - 如何并排连接两个图像?
- salesforce-lightning - 如何清除 sfdx 缓存(如果存在这种情况)
- python - 如何在pytorch中初始化不同样式的nn.Sequential块的不同层的权重?
- javascript - 如何使用异步在js中动态设置参数?
- css - Bootstrap 4:使图像大于容器