18

GitHub - wongzy/RecyclerWheelView: An efficient WheelView based on RecyclerView,...

 4 years ago
source link: https://github.com/wongzy/RecyclerWheelView?
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

RecyclerWheelView

中文文档

An efficient Android WheelView based on RecyclerView, which is easy to use, and it can customized by yourself.

Getting Started

First of all, this lib is based on androidx, if your library do not migrate to androidx, there might be some problems if you used this.

If you want to use this library, you should add those to your module's gradle

implementation 'cn.wongzhenyu:recyclerwheelview:0.0.3'
implementation 'androidx.recyclerview:recyclerview:XXX'

Because RecyclerWheelView have dependency of recyclerview(library of androidx), and to avoid the conflicts of library version, I used compileonly to import recyclerview library, so you should add recyclerview by yourself.

Result

there are two examples' results about recyclerwheelview in this project, if you used recyclerwheelview, you can make this effect easily.

String wheel view

68747470733a2f2f692e6c6f6c692e6e65742f323032302f30352f31302f66387543336a556948464136715a592e6a7067

The attributes of StringWheelView and its explain as follows:

attribute name explain example
wheelSelectedItemTextColor the color of selected String app:wheelSelectedItemTextColor="@color/colorAccent"
wheelSelectedTextSize the size of selected String app:wheelSelectedTextSize="18sp"
wheelSelectedItemBackground the background of selected String item(can use custom drawable) app:wheelSelectedItemBackground="@drawable/string_selected_wheel_bg"
wheelNormalTextSize the size of unselected String app:wheelNormalTextSize="15sp"
wheelNormalTextColor the color of unselected String app:wheelNormalTextColor="@color/colorPrimaryDark"
wheelNormalItemBackground the background of unselected String item(can use costom drawable) app:wheelNormalItemBackground="@drawable/string_nor_wheel_bg"
wheelItemHeight the height of String item, attention, the height of selected String item and unselected String item is same app:wheelItemHeight="100dp"

Custom wheel view

68747470733a2f2f692e6c6f6c692e6e65742f323032302f30352f31302f57697a6550423539436a4c4b3167772e6a7067

You can customize RecyclerWheelView just like recycler view, you can see how it realize in this demo project.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK