Android的ListView的填充内容不移动的ListView的高度? [英] Android ListView padding for content without moving ListView height?

查看:294
本文介绍了Android的ListView的填充内容不移动的ListView的高度?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一大堆里面的物品一个ListView。如何让我的顶部和底部的项目有10dp的上边距顶级项目,10dp的底部项目的底部边缘?现在,我可以做到这一点与填充或利润率在ListView但结果是,当你滚动的ListView的边缘,现在从屏幕底部10dp。无论如何围绕这吗?我自己也尝试设置我的适配器的getView方法里面的利润,但我没有看到任何AbsListView.LayoutParams保证金选项。任何帮助将是巨大的。

I have a ListView with a bunch of items inside it. How do I make the top and bottom items have a top margin of 10dp for top item and bottom margin of 10dp for bottom item? Now I can do this with padding or margin on the ListView but the result is that when you scroll the edge of the ListView is now 10dp from the bottom of the screen. Anyway around this? I have also tried setting margins inside of the getView method of my adapter but I don't see any margin options for AbsListView.LayoutParams. Any help would be great.

感谢

推荐答案

关键是要包括安卓clipToPadding =假在视图定义,如:

The trick is to include android:clipToPadding="false" in your view definition, e.g.:

<ListView android:id="@+id/list"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:paddingTop="16dip"
    android:paddingBottom="16dip"
    android:clipToPadding="false" />

这篇关于Android的ListView的填充内容不移动的ListView的高度?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆