![](/img/trans.png)
[英]How to collapse a view to the bottom of the screen in android using coordinator layout?
[英]Why Fix Button in Bottom in Coordinator Layout scroll with recycle view in 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>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.