zhanghai / AndroidFastScroll

Fast scroll for Android RecyclerView and more
https://play.google.com/store/apps/details?id=me.zhanghai.android.fastscroll.sample
Apache License 2.0
698 stars 64 forks source link

支持PreferenceFragmentCompat #42

Closed allentown521 closed 2 years ago

allentown521 commented 2 years ago

Expected Behavior

能否支持PreferenceFragmentCompat?PreferenceFragmentCompat里面也是RecyclerView,但是实际使用后默认的滚动条和fastscroll会同时出现 image

Actual Behavior

Steps to Reproduce the Problem

1. 1. 1.

Specifications

allentown521 commented 2 years ago

补充一点,根布局是:CoordinatorLayout,使用了app:layout_behavior="com.google.android.material.appbar.AppBarLayout$ScrollingViewBehavior"

allentown521 commented 2 years ago

<androidx.coordinatorlayout.widget.CoordinatorLayout 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="?attr/colorSurface" android:fitsSystemWindows="true"> //PreferenceFragmentCompat嵌在这里view里面 <androidx.fragment.app.FragmentContainerView android:id="@+id/settingsContainer" android:layout_width="match_parent" android:layout_height="match_parent" app:layout_behavior="com.google.android.material.appbar.AppBarLayout$ScrollingViewBehavior" />

allentown521 commented 2 years ago

通过设置recyclerView.setVerticalScrollBarEnabled(false);解决了,但是似乎不太适合短列表的滚动显示,滚动条长度是固定的

allentown521 commented 2 years ago

列表滚动到底部后,滚动条没有滚动到底部

zhanghai commented 2 years ago

是的,你需要关闭自带的 scrollbar。这个库的滚动条长度是固定的,如果你想要变长的你可以用 RecyclerView 自带的 fastscroll(例如这篇文章)。