LeaningAndroid
LeaningAndroid

Reputation: 475

How to go past the last item in a recycle view when scrolling up

I have a recycleview that I like to go past the last element when I scroll up. The reason I need to do this is that I have a floating button that if I don't go past the last item, the floating button covers the right part of the last item. I have seen this done in apps such as WhatsApp (see screenshot).

My approach has been to add two empty items to the end of my list and then set visibility of views based on if the items are empty or not. I feel this is more a hack and I was wondering if there is a better way around this.

Below is a screen shot from WhatsApp where at the end of the list, the list scrolls further.

Thanks in advance

Screenshot from WhatApp

Upvotes: 2

Views: 518

Answers (1)

NIKHIL AGGARWAL
NIKHIL AGGARWAL

Reputation: 478

There is not need to add two blank items to recyclerview. It may introduce bugs as well while adding new items to the recyclerview. You just need to provide paddingBottom to the recyclerview equal to the height of floating action button and set clipToPadding = false to the recyclerview.

Upvotes: 4

Related Questions