0

I've got a button which adds items to a listview and there's a line between each item. Any idea about how to remove that line?

Here's the individual item layout XML:

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

<EditText
    android:id="@+id/subjectname"
    android:layout_width="0sp"
    android:layout_height="fill_parent"
    android:layout_weight="2"
    android:gravity="center_vertical"
    android:hint="@string/subjectname"
    android:textAppearance="?android:attr/textAppearanceSmall" />

<EditText
    android:id="@+id/subjectmark"
    android:layout_width="0sp"
    android:layout_height="fill_parent"
    android:layout_weight="1"
    android:gravity="center"
    android:hint="@string/subjectmark"
    android:textAppearance="?android:attr/textAppearanceSmall" />

<ImageButton
    android:id="@+id/remove"
    android:layout_width="@dimen/width_button"
    android:layout_height="fill_parent"
    android:contentDescription="@string/app_name"
    android:onClick="removeClick"
    android:background="@drawable/custombutton1"
    android:src="@drawable/ic_action_discard" />
</LinearLayout>

And here is the listview layout XML:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".ListViewActivity" >

<Button
    android:id="@+id/addsubject"
    android:layout_width="250dp"
    android:layout_height="wrap_content"
    android:layout_centerHorizontal="true"
    android:layout_alignParentTop="true"
    android:layout_marginTop="20dp"
    android:text="@string/addsubject"
    android:textColor="@color/white"
    android:background="@drawable/custombutton1" />

<ListView
    android:id="@+id/subject_list_item"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_marginTop="20dp"
    tools:listitem="@layout/subject_list_item"
    android:layout_below="@+id/addsubject" >

</ListView>


</RelativeLayout>

Hope there's a solution. Thanks in advance!

Isaías
  • 491
  • 2
  • 9
  • 20

1 Answers1

1

The line between the list items is the divider. You can easily remove that using XML; just add the following to your ListView:

        android:divider="@null"
        android:dividerHeight="0dip"

That will remove the divider for you.

Cruceo
  • 6,763
  • 2
  • 31
  • 52