开发者

ListView last item aligned to the bottom

I would like to have last item of the listView aligned on the bottom. In case there are 1 to several items on the list, there should be an empty space between last item and second to last item. In case there are many items (they do not fit in the list, scroll is shown), the list should behave normally. I tried to make it so that when list consists of some small hardcoded number (6) of items (or less), last item is separate 开发者_开发百科view aligned to the bottom of the parent of the listView. When there are more items, I set visibility of this view to GONE and added same view to the listView. It was working fine, but not for all devices. Some fit 6 items, but others fit 7.

Is there any way to align last item to the bottom of the listView (so the listView has always the same height as its parent)?


Maybe the easiest way to implement this will be just to add your last element as footer using addFooterView

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜