Head suspension control based on recycleview developed by Android

Recyclerview is a sliding list similar to listview, but compared with listview, recyclerview is better than listview. Recyclerview supports horizontal sliding. Recyclerview does not have click events and needs to be added by itself. It can also make various cool effect animations, which is more in line with high cohesion and low coupling,

preface

A few days ago, I saw a filter box sliding in recycleview, which can be suspended in the head. The effect is similar to the business opportunity module in the business opportunity box.

The idea was conventional

After hard help, I realized it through the decorator of recycleview. Of course, I also stood on the shoulders of big men, combined with my own business processing, and then sorted it into a private library. Usage:

rely on

The first step is in bulid.gradle of the project

allprojects {
 repositories {
  ...
  maven { url 'https://jitpack.io' }
 }
 }

Step 2: add dependency

dependencies {
     implementation 'com.github.Qiaoshi96:StickyRecycleView:1.2'
 }

It is based on the recycleview dependency. When using, add the recycleview dependency first

implementation ‘com.android.support:recyclerview-v7:26.1.0'

The specific usage (dome address) can be through GitHub:

https://github.com/Qiaoshi96/StickyRecycleView.git

layout

 <com.example.stickylib.StickyRecyclerView
    android:id="@+id/recycler_linear"
    android:layout_width="match_parent"
    android:layout_height="match_parent" />

The adapter will not be pasted. You can download the DOM and run it

design sketch

Here I do the effect of clicking back to the top, which can be set according to the business

summary

The above is the head suspension control based on recycleview developed by Android introduced by Xiaobian. I hope it will be helpful to you. If you have any questions, please leave me a message and Xiaobian will reply to you in time. Thank you very much for your support to our website! If you think this article is helpful to you, welcome to reprint, please indicate the source, thank you!

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>