android – 滚动时ListView填充

前端之家收集整理的这篇文章主要介绍了android – 滚动时ListView填充前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我想在ListView顶部添加填充,滚动ListView后我想将填充设置为0.

我尝试在ListView和Layout的顶部添加填充,但两者都不起作用.

这就是我想要的:

(在ListView /滚动之前)

(向下滚动ListView /滚动后)

解决方法

你必须设置 android:clipToPadding =“false”

像这样:

<ListView
    android:id="@+id/your_listview"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:cacheColorHint="#00000000"
    android:paddingBottom="15dp"
    android:paddingTop="15dp"
    android:clipToPadding="false"
    android:scrollbars="none" >
</ListView>
原文链接:https://www.f2er.com/android/313861.html

猜你在找的Android相关文章