刷新与RecycleView冲突问题

解决办法

刷新控件第一层写一个NestedScrollView
在这里插入图片描述

全部代码

<?xml version="1.0" encoding="utf-8"?>
<com.lcodecore.tkrefreshlayout.TwinklingRefreshLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:id="@+id/trl_classificationContent_refresh"
    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">
<androidx.core.widget.NestedScrollView
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".ui.activity.ClassificationContentActivity">
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical"
        android:background="#FFF9F9F9"
        tools:context=".ui.fragment.BlankFragment">
        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="horizontal">
            <LinearLayout
                android:layout_marginHorizontal="10dp"
                app:layout_constraintEnd_toStartOf="@+id/linearLayout3"
                app:layout_constraintStart_toStartOf="parent"
                app:layout_constraintTop_toBottomOf="@+id/cv_title"
                style="@style/ll_fg_other_voice_title">

                <com.bytedance.sdk.openadsdk.core.widget.TTRoundRectImageView
                    android:id="@+id/iv1"
                    android:layout_width="50dp"
                    android:layout_height="50dp"
                    android:src="@drawable/shape_blue" />

                <TextView
                    android:text="排行版1"
                    style="@style/tv_fg_other_voice_title" />
            </LinearLayout>

            <LinearLayout
                android:layout_marginHorizontal="10dp"
                style="@style/ll_fg_other_voice_title"
                app:layout_constraintBottom_toBottomOf="@+id/linearLayout2"
                app:layout_constraintEnd_toStartOf="@+id/linearLayout4"
                app:layout_constraintStart_toEndOf="@+id/linearLayout2"
                app:layout_constraintTop_toTopOf="@+id/linearLayout2">

                <com.bytedance.sdk.openadsdk.core.widget.TTRoundRectImageView
                    android:id="@+id/iv2"
                    android:layout_width="50dp"
                    android:layout_height="50dp"
                    android:src="@drawable/shape_blue" />

                <TextView
                    style="@style/tv_fg_other_voice_title"
                    android:text="排行榜2" />
            </LinearLayout>

            <LinearLayout
                android:layout_marginHorizontal="10dp"
                style="@style/ll_fg_other_voice_title"
                app:layout_constraintBottom_toBottomOf="@+id/linearLayout3"
                app:layout_constraintEnd_toEndOf="parent"
                app:layout_constraintStart_toEndOf="@+id/linearLayout3"
                app:layout_constraintTop_toTopOf="@+id/linearLayout3">

                <com.bytedance.sdk.openadsdk.core.widget.TTRoundRectImageView
                    android:id="@+id/iv_3"
                    android:layout_width="50dp"
                    android:layout_height="50dp"
                    android:src="@drawable/shape_blue" />

                <TextView
                    android:id="@+id/tv_3"
                    style="@style/tv_fg_other_voice_title"
                    android:text="排行榜3" />
            </LinearLayout>
        </LinearLayout>
        <TextView
            android:textSize="23sp"
            android:id="@+id/textView3"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginTop="16dp"
            android:layout_marginLeft="16dp"
            android:text="超火壁纸"
            android:textStyle="bold"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toBottomOf="@+id/lL_double" />

        <androidx.recyclerview.widget.RecyclerView
            android:descendantFocusability="blocksDescendants"
            android:id="@+id/rv_classification_content"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_gravity="center"
            android:layout_marginTop="16dp"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toBottomOf="@+id/textView3" />
    </LinearLayout>
</androidx.core.widget.NestedScrollView>
</com.lcodecore.tkrefreshlayout.TwinklingRefreshLayout>

猜你喜欢

转载自blog.csdn.net/sunweihao2019/article/details/108348502