在嵌套滚动视图中向上滚动时如何在单击侦听器上设置嵌套滚动视图

问题描述 投票:0回答:1

[您好,有一个嵌套的滚动视图,我想在单击侦听器上设置嵌套的滚动视图,这样它在向上滚动嵌套的滚动视图时会执行某些操作,例如在向上滚动嵌套的滚动视图时显示吐司显示向上滚动并用于显示在向下滚动嵌套滚动视图时向下滚动的烤面包]

这是我的嵌套滚动视图


<androidx.core.widget.NestedScrollView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:clipToPadding="false"
            app:layout_behavior="com.google.android.material.appbar.AppBarLayout$ScrollingViewBehavior">

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="vertical"
                android:layout_margin="5dp">

                <TextView
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:text="@string/lorem_ipsum"
                    />

            </LinearLayout>

        </androidx.core.widget.NestedScrollView>

android android-studio android-nestedscrollview
1个回答
0
投票
我认为您可以使用SwipeRefreshLayout而不是NestedScrollView。您可以通过回调管理滚动功能。
© www.soinside.com 2019 - 2024. All rights reserved.