Last item of ListView: Fab hides it
Asked Answered
N

2

6

My problem is that i have a ListView with a floating action button attached to it. But the FAB hides a button if the list is at the very end. So I want to apply some free space but only to the last item of the list.

I'm using a simple adapter extending the BaseAdapter. So in getView, I could apply anything to the convertView if position == getCount()-1.

But how can I make that extra free space?

When I set padding via convertView.setPadding, to 56dp the size does not increase, it just hides the elements in my ListView. If I use LinearLayout.Layoutparams and set margins, nothing happens at all. So what can I do here?

Noranorah answered 7/3, 2015 at 15:23 Comment(0)
G
20

Set bottom padding to the ListView itself. You have to set android:clipToPadding="false" to the ListView as well.

Grumble answered 7/3, 2015 at 15:28 Comment(3)
Does someone know how much the padding has to be? For a normal size FAB? How can we get that value?Playwriting
@Blunderer, at least 56dpGrumble
This is a good solution, the problem with one is the scrollbar does not fill the heightBleary
A
1

as well as Egor's approach, you can also use ListView.setFooterView(View v) to an inflated view that's as tall as your fab.

Astrograph answered 7/3, 2015 at 15:52 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.