I am using RecyclerView from support.v7 library to display items on shopping list.
When I'm scrolling to the end of my data, I can't see the price in the right side of the last item.
I want to add some space after scrolling to the last item, so that the button don't cover it.
Here is the image of the App with RecyclerView and FAB:
I can simply add an empty object to the list for an Adapter, but in this case it will behave like the rest of rows (it will have checkbox, and price 00.00 on the right side).
Is there another way to do that?
How to add dividers and spaces between items in RecyclerView? This example demonstrate about How to add dividers and spaces between items in RecyclerView Step 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project.
Add the ItemDecoration to the RecyclerView as above. This adds equal spacing to the RecyclerView items as shown in the figure below. Instead of adding all the margins using the ItemDecoration, we can add the left, top, right margins in the item layout file and add a bottom margin to the last item using the below ItemDecoration.
There are two methods you can use to add an ItemDecoration instance to RecyclerView: All added instances of RecyclerView.ItemDecoration are put in a single list and drawn simultaneously.
Step 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project. Step 2 − Add the following code to res/layout/activity_main.xml. In the above code, we have taken recycerview.
You can add bottomPadding
and disable clipping
, such as:
<RecyclerView
android:layout_width="match_parent"
android:layout_height="match_parent"
<!-- Bottom Padding, or space below last item -->
android:paddingBottom="10dp"
<!-- Clipping diabled -->
android:clipToPadding="false" />
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With