Vlad Alexeev
Vlad Alexeev

Reputation: 2204

ListView and footer - how to eliminate space between them?

There's a kind of glitch between last listview's element and it's footer - it doesn't have a divider but it has a space for that . so , if I make a black background, for instance, this glitching space will be black and so on.

How can I eliminate this spacing ?

View v = getLayoutInflater().inflate(R.layout.footer_for_main, null);
//adding a footer:
    lvMain.addFooterView(v);
<ListView
    android:id="@+id/lvMain"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_above="@+id/main_footer_tile_long"
    android:layout_alignParentLeft="true"
    android:layout_below="@+id/ver_main_donate_background_tile_long"
    android:divider="@drawable/linear"
    android:footerDividersEnabled="false"
    android:headerDividersEnabled="false"

    android:listSelector="@drawable/selector_main_list" >

</ListView>

enter image description here

Upvotes: 1

Views: 362

Answers (1)

tpbapp
tpbapp

Reputation: 2506

You could try:

footerView.setPadding(0, -3, 0, 0);

As 3px is the default height of the divider.

Upvotes: 1

Related Questions