RecyclerView 快速滚动窗口小部件

网友投稿 608 2022-11-04

RecyclerView 快速滚动窗口小部件

RecyclerView 快速滚动窗口小部件

Widget for RecyclerView fast scrolling, like Android's built-in fast scroll option for ListView. Supports any vertically scrolling LayoutManager, as well as proper integration for AppBarLayout.

Planned features are listed at the issues page. You can download the sample APK from the releases page.

Sample

Dependency

Add this to your module's build.gradle file:

repositories { //... maven { url "https://jitpack.io" }}dependencies { //... compile 'com.github.pluscubed:recycler-fast-scroll:{latest-version}@aar'}

The library is versioned according to Semantic Versioning.

Basic Usage

Add the widget to your layout file, e.g.: Attach the RecyclerFastScroller to your RecyclerView:fastScroller.attachRecyclerView(recyclerView); If the adapter hasn't been set when you attach the fast scroller, call attachAdapter() afterwords.

See the sample project for demos.

AppBarLayout support

Use attachAppBarLayout(coordinatorLayout, appBarLayout). See the sample project for the demo.

Customization

MethodAttributeDescription
setBarColor(int color)rfs_barColorColor of scrollbar. Defaults to colorControlNormal attribute. Alpha of ~22% is applied to the drawable to match stock ListView fast scroller.
setHandleNormalColor(int color)rfs_handleNormalColorColor of handle. Defaults to colorControlNormal attribute.
setHandlePressedColor(int color)rfs_handlePressedColorColor of pressed handle. Defaults to colorAccent attribute.
setTouchTargetWidth(int width)rfs_touchTargetWidthWidth of the touch target. Defaults to 24dp (while the Android docs recommend at least 48dp, 24dp is more practical considering it will block touch in the right of the RecyclerView).
setHideDelay(int milliseconds)rfs_hideDelayHide delay in milliseconds. Defaults to 1500ms.
setHidingEnabled(boolean enabled)rfs_hidingEnabledWhether scrollbar is hidden after delay. Defaults to true.
setOnHandleTouchListener(OnTouchListener listener)--Sets listener for handle touch events.

Corresponding getters are also available.

Attribute Usage

License

Copyright 2016 Daniel CiaoLicensed 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://apache.org/licenses/LICENSE-2.0Unless required by applicable law or agreed to in writing, softwaredistributed 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 andlimitations under the License.

版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。

上一篇:深入理解 sudo 与 su 之间的区别
下一篇:数据结构之逻辑结构与物理结构(存储结构)
相关文章

 发表评论

暂时没有评论,来抢沙发吧~