Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Last item of ListView: Fab hides it

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?

like image 293
Paul Woitaschek Avatar asked Mar 07 '15 15:03

Paul Woitaschek


2 Answers

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

like image 82
Egor Neliuba Avatar answered Oct 11 '22 12:10

Egor Neliuba


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.

like image 37
hirbodk Avatar answered Oct 11 '22 14:10

hirbodk