滚动recyclerview时,底部cardview移至上方

问题描述

我将卡片视图,滚动视图和其他视图组合在一起进行布局。我使用线性布局制作了一个自定义底部视图,但是在滚动视图中,当我滚动recyclerview时,该底部视图移动了它们的位置,但是它隐藏了其中一半的图片来解释它。

enter image description here

当我滑动回收站时,您会看到底部的卡片视图有一个按钮,视图向上移动,但认情况下它向下设置

有很多代码没问题,问题在于底部的卡片视图已移动,并且认情况下未设置在我想要的位置。

<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:id="@+id/overViewFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="10"
android:orientation="vertical"
tools:context=".OverviewFragment">

<ScrollView
    android:id="@+id/overview_scrollView"
    android:layout_width="match_parent"
    android:layout_height="0dp"
    android:layout_weight="9">
</ScrollView>
<androidx.cardview.widget.CardView
    android:id="@+id/bottom_cardView"
    android:layout_width="match_parent"
    android:layout_height="0dp"
    android:layout_gravity="bottom"
    android:layout_weight="1">

    <androidx.constraintlayout.widget.ConstraintLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="@dimen/_8sdp"
        android:background="@color/white">

        <TextView
            android:id="@+id/store_bottom"
            android:layout_width="@dimen/_40sdp"
            android:layout_height="@dimen/_30sdp"
            android:layout_marginStart="@dimen/_4sdp"
            android:gravity="center"
            android:text="@string/store"
            android:textSize="@dimen/_9sdp"
            app:drawableTint="@color/lightOrange"
            app:drawabletopCompat="@drawable/ic_store"
            app:layout_constraintBottom_toBottomOf="parent"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toTopOf="parent" />

        <TextView
            android:id="@+id/chat_bottom"
            android:layout_width="@dimen/_40sdp"
            android:layout_height="@dimen/_30sdp"
            android:gravity="center"
            android:text="@string/chat"
            android:textSize="@dimen/_9sdp"
            app:drawableTint="@color/lightOrange"
            app:drawabletopCompat="@drawable/ic_chat"
            app:layout_constraintBottom_toBottomOf="parent"
            app:layout_constraintEnd_toStartOf="@id/buy_bottom_buton"
            app:layout_constraintStart_toEndOf="@+id/store_bottom"
            app:layout_constraintTop_toTopOf="parent"
            tools:ignore="UnusedAttribute" />

        <Button
            android:id="@+id/buy_bottom_buton"
            android:layout_width="@dimen/_100sdp"
            android:layout_height="@dimen/_35sdp"
            android:layout_marginStart="@dimen/_4sdp"
            android:background="@drawable/menu_background"
            android:backgroundTint="@color/lightOrange"
            android:text="@string/buy_Now"
            android:textColor="@color/white"
            android:textSize="@dimen/_11ssp"
            app:layout_constraintBottom_toBottomOf="parent"
            app:layout_constraintEnd_toStartOf="@id/add_cart_bottom"
            app:layout_constraintStart_toEndOf="@id/chat_bottom"
            app:layout_constraintTop_toTopOf="parent" />

        <Button
            android:id="@+id/add_cart_bottom"
            android:layout_width="@dimen/_100sdp"
            android:layout_height="@dimen/_35sdp"
            android:background="@drawable/menu_background"
            android:backgroundTint="@color/lightred"
            android:text="@string/add_to_cart"
            android:textColor="@color/white"
            android:textSize="@dimen/_11ssp"
            app:layout_constraintBottom_toBottomOf="parent"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintStart_toEndOf="@id/buy_bottom_buton"
            app:layout_constraintTop_toTopOf="parent" />

    </androidx.constraintlayout.widget.ConstraintLayout>
</androidx.cardview.widget.CardView>

`

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)