Android recyclerview sample code for fast scrolling

Brief comment: a long-awaited function has finally been realized in Android support library 26: rapid scrolling of recyclerview.

Android officials have long suggested that developers use recyclerview instead of listview. Recyclerview does perform better than listview, except that it does not scroll quickly, as shown below:

Therefore, in order to realize fast scrolling on recyclerview, we often rely on third-party libraries, such as futuremind / recycler fast scroll or timus / recyclerview fastscroll.

Now that recyclerview finally supports fast scrolling natively, let's take a look at how to implement it:

First, add dependencies in build.gradle:

Note that the support library has been moved to Google's Maven repository since version 26, and Google plans to publish all repositories only through http://maven.google.com in the future. Therefore, you need to refer to the official guide to use Google Maven warehouse.

Now, let's take a look at how to realize the rapid scrolling of recyclerview:

Several attributes are added:

Next, let's look at the specific drawable:

line_ drawable.xml

line.xml

thumb_ drawable.xml

thumb.xml

The effects are as follows:

The above is the whole content of this article. I hope it will be helpful to your study, and I hope you can support programming tips.

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
分享
二维码
< <上一篇
下一篇>>