git://www.github.com/timusus/RecyclerView-FastScroll.git
git clone http://www.github.com/timusus/RecyclerView-FastScroll
$ svn co --depth empty http://www.github.com/timusus/RecyclerView-FastScroll
Checked out revision 1.
$ cd repo
$ svn up trunk
一个简单的FastScroller
RecyclerView
。
使用 LinearLayoutManager
或者 GridLayoutManager
( 包括多个范围) 支持垂直 RecyclerViews
。
样式是基于 ListView
FastScroller
的,不管 Lollipop的最后一个版本是什么。 这个库大量借用了来自谷歌的 Launcher3的。
compile 'com.simplecityapps:recyclerview-fastscroll:1.0.17'
你必须使用 FastScrollRecyclerView
作为基础 RecyclerView
。 如果你遇到问题,请查看示例项目。
通过 xml:
<com.simplecityapps.recyclerview_fastscroll.views.FastScrollRecyclerView
android:id="@+id/recycler"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:fastScrollPopupBgColor="@color/colorAccent"
app:fastScrollPopupTextColor="@android:color/primary_text_dark"
app:fastScrollThumbColor="@color/colorAccent"/>
要显示 FastScrollPopup
,适配器必须实现 FastScrollRecyclerView.SectionedAdapter
并重写 getSectionName()
。
如果需要知道什么时候启动或者停止滚动,则可以将OnFastScrollStateChangedListener附加到 FastScrollRecyclerView 。
行高默认情况下,FastScrollRecyclerView
假定适配器中的所有项都具有相同的高度。 如果适配器具有不同高度的视图,则应使适配器实现 MeasurableAdapter
接口并重写 getViewTypeHeight()
。
getViewTypeHeight()
返回给定类型的单个视图的高度( 以像素为单位) 。 视图类型的所有实例之间的高度必须是固定的并且是固定的。 由于实现者在视图布局之前负责计算这里值,因这里不适用于视图的高度由项的可以变行数。
目前,MeasurableAdapter
仅适用于 LinearLayoutManager
。 使用 MeasurableAdapter
与一个超过一个 span的GridLayoutManager
将导致滚动条拇指到达滚动条背景背景之前的列表底部。
你可以使用xml中的fastScrollAutoHide
& fastScrollAutoHideDelay
属性启用/禁用自动隐藏:
<com.simplecityapps.recyclerview_fastscroll.views.FastScrollRecyclerView
app:fastScrollAutoHide="true"
app:fastScrollAutoHideDelay="1500"
. . .
或者通过 setAutoHideDelay(int hideDelay)
以编程方式 setAutoHideEnabled(boolean autoHideEnabled)
弹出背景,弹出文本,popupBackground大小,弹出文本大小,轨迹背景,缩略图颜色和弹出位置都可以通过xml进行样式设置:
<com.simplecityapps.recyclerview_fastscroll.views.FastScrollRecyclerView
app:fastScrollPopupBgColor="@color/colorAccent"
app:fastScrollPopupTextColor="@android:color/primary_text_dark"
app:fastScrollPopupTextSize="56sp"
app:fastScrollPopupBackgroundSize="88dp"
app:fastScrollThumbColor="@color/colorAccent"
app:fastScrollTrackColor="#1f000000"
app:fastScrollPopupPosition="adjacent"/>
. . .
或者通过 setThumbColor(@ColorInt int color)
,setTrackColor(@ColorInt int color)
, setPopupBgColor(@ColorInt int color)
, setPopupTextColor(@ColorInt int color)
setPopupTextSize(int size)
& setPopupPosition(@FastScroller.FastScrollerPopupPosition int position)
你可以通过以下方式启用/禁用快速滚动:
<com.simplecityapps.recyclerview_fastscroll.views.FastScrollRecyclerView
app:fastScrollThumbEnabled="false"
. . .
通过编程方式或者通过编程方式 setFastScrollThumbEnabled(boolean enabled)
1.0.17
MeasurableAdapter
调整MeasurableAdapter
fastScrollThumbEnabled
属性)1.0.16
MeasurableAdapter
增加了对不同行高的支持1.0.15
1.0.14
1.0.13
1.0.12
1.0.11
1.0.10
v1.0.9
RecyclerView
上没有设置适配器时固定崩溃RecyclerView
子进程为空( 。itemCount
为非零,但 getChildAt(0)
返回 null ) 。v1.0.6
FastScrollPopup
不再要求适配器实现 SectionIndexer
,而是 FastScrollRecyclerView.SectionedAdapter
这更容易使用。recyclerview fastscroll
Copyright (C) 2016 Tim Malseed
Licensed under the Apache License, Version 2.0 (the"License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an"AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
启动器 3:
Copyright (C) 2010 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the"License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an"AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.