Android recyclerview uses the gridlayoutmanager spacing setting method

To set the spacing using recyclerview, you need to override the class recyclerview.itemdecoration. The following renderings need to be implemented. The spacing is only between the middle grid and the bottom format.

The implementation method is very simple, because this effect is that each row has 3 grids, as long as the left spacing of the first format of each row is 0. All others set the left margin and bottom distance.

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