微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

除非您停止触摸,否则Recyclerview不会折叠colbarsingtoolbarlayout

如何解决除非您停止触摸,否则Recyclerview不会折叠colbarsingtoolbarlayout

当我在回收站视图中滚动时,collapsingtoolbarlayout直到我移开手指后才反应,并且当它已经合拢并且向上滚动时,它直到在不按住手指的情况下滚动才会展开,该如何解决?这是我的代码

<?xml version="1.0" encoding="utf-8"?>
<androidx.coordinatorlayout.widget.CoordinatorLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:fitsSystemWindows="true">

    <com.google.android.material.appbar.AppBarLayout
        android:id="@+id/appbar"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:theme="@style/AppTheme.AppBarOverlay"
        android:fitsSystemWindows="true"
        app:layout_behavior=".tools.HeaderBehavior">

        <com.google.android.material.appbar.CollapsingToolbarLayout
            android:id="@+id/collaptool"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            app:contentScrim="@color/colorPrimary"
            app:layout_scrollFlags="snap|scroll|exitUntilCollapsed"
            android:fitsSystemWindows="true"
            app:titleEnabled="false">

            <ImageView
                android:id="@+id/iv_m"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                app:layout_collapseMode="parallax"
                android:fitsSystemWindows="true"
                android:scaleType="centerCrop"/>

            <View
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:background="@drawable/bg_gradient"
                android:fitsSystemWindows="true"
                app:layout_collapseMode="pin"/>

            <include layout="@layout/view_details_main_test"/>


            <androidx.appcompat.widget.Toolbar
                android:id="@+id/toolbar"
                android:layout_width="match_parent"
                android:layout_height="?attr/actionBarSize"
                app:layout_collapseMode="pin"
                app:popupTheme="@style/AppTheme.PopupOverlay"
                android:background="@color/transparent"
                android:layout_gravity="top">

            </androidx.appcompat.widget.Toolbar>


        </com.google.android.material.appbar.CollapsingToolbarLayout>

    </com.google.android.material.appbar.AppBarLayout>


    <FrameLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        app:layout_behavior="@string/appbar_scrolling_view_behavior">


        <androidx.recyclerview.widget.RecyclerView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:id="@+id/rv_m"/>

    </FrameLayout>
</androidx.coordinatorlayout.widget.CoordinatorLayout>

这些是我的依赖项

implementation filetree(dir: "libs",include: ["*.jar"])
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'androidx.recyclerview:recyclerview:1.1.0'
implementation 'com.google.android.material:material:1.2.0'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.gridlayout:gridlayout:1.0.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'

我需要用collapsingtoolbarlayout随recyclerview一起移动,否则看起来很糟糕,对不起,如果我的英语不好,希望您能理解我,谢谢您的帮助

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。