smb
smb

Reputation: 834

Can't remove the last divider in ListView

I have a ListView which must fill whole free space in a parent layout. I want to remove the last divider and this is my code:

<?xml version="1.0" encoding="utf-8"?>

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent" >

    <ListView
        android:id="@+id/listView"
        android:layout_height="0dp"
        android:layout_weight="1"
        android:layout_width="fill_parent"
        android:choiceMode="singleChoice"
        android:listSelector="@drawable/popup_table_row"
        android:footerDividersEnabled="false"
        android:headerDividersEnabled="false" />

    <Button
        android:id="@+id/cancelbutton"
        android:layout_height="wrap_content"
        android:layout_width="fill_parent"
        android:text="@string/cancel"
        style="@style/ButtonTextBold"
        android:background="@drawable/blue_button" />

</LinearLayout>

The android:headerDividersEnabled="false" does nothing. The last divider is not removed. I tried to implement the layout using the RelativeLayout and setting the height of the listView to fill_parent, but it also doesn't help.

Upvotes: 2

Views: 2275

Answers (2)

Jaspreet Chhabra
Jaspreet Chhabra

Reputation: 1431

use list view property android:divider="@null"

Upvotes: 1

Umer Kiani
Umer Kiani

Reputation: 3370

Try This

<ListView
    android:id="@+id/listView1"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_alignLeft="@+id/ibtn_regstepone_fbconnect"
    android:layout_below="@+id/btn_regstepone_alreadymember"
    android:layout_marginTop="59dp" 
    android:divider="@null">

Upvotes: 0

Related Questions