ExtraLayoutSpace of RecyclerView

15
ExtraLayoutSpace of RecyclerView kyobashi.dex #2 @amyu_san

Transcript of ExtraLayoutSpace of RecyclerView

Page 1: ExtraLayoutSpace of RecyclerView

ExtraLayoutSpace of RecyclerView

kyobashi.dex #2 @amyu_san

Page 2: ExtraLayoutSpace of RecyclerView

ABOUT ME

▸ Name : Yuki Mima

▸ Twitter : @amyu_san

▸ github : amyu

▸ Work : Android App Engineer

Page 3: ExtraLayoutSpace of RecyclerView

Why do you use RecyclerView

Page 4: ExtraLayoutSpace of RecyclerView

I can not be implemented in the ListView

Page 5: ExtraLayoutSpace of RecyclerView

TEXT

The good point of RecyclerView

▸ Easy implementation of Animation

▸ Easy implementation of Animation

▸ Easy implementation of Animation

▸ Easy implementation of Animation

▸ Easy implementation of pre-load

▸ Easy implementation of Cache

Page 6: ExtraLayoutSpace of RecyclerView

TEXT

What is ExtraLayoutSpace

▸ The amount of extra space that should be laid out by LayoutManager.

Page 7: ExtraLayoutSpace of RecyclerView

ExtraLayoutSpace = 0

Page 8: ExtraLayoutSpace of RecyclerView

https://www.youtube.com/watch?v=1xMNmMjqEbI

Page 9: ExtraLayoutSpace of RecyclerView

ExtraLayoutSpace = Display Heigh

Page 10: ExtraLayoutSpace of RecyclerView

https://www.youtube.com/watch?v=4c7ZID7yjII

Page 11: ExtraLayoutSpace of RecyclerView

TEXT

How to implement

▸ Override the LinearLayoutManager#getExtraLayoutSpace

Returns the amount of extra space that should be laid out by LayoutManager.

By default, LinearLayoutManager lays out 1 extra page of items while smooth scrolling and 0 otherwise.

You can override this method to implement your custom layout pre-cache logic.

protected int getExtraLayoutSpace (RecyclerView.State state)

Page 12: ExtraLayoutSpace of RecyclerView
Page 13: ExtraLayoutSpace of RecyclerView

Laying out invisible elements will eventually come with performance cost!

Page 14: ExtraLayoutSpace of RecyclerView

But it improves user experience!!!!

Page 15: ExtraLayoutSpace of RecyclerView

Try to use!