Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/217.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 删除listview项下的行_Android_Android Listview - Fatal编程技术网

Android 删除listview项下的行

Android 删除listview项下的行,android,android-listview,Android,Android Listview,我有一个按钮,可以将项目添加到列表视图中,每个项目之间都有一行。你知道怎么去掉那条线吗 以下是单个项目布局XML: <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="horizontal"

我有一个按钮,可以将项目添加到列表视图中,每个项目之间都有一行。你知道怎么去掉那条线吗

以下是单个项目布局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>
<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>

下面是listview布局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>
<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>


希望有解决办法。提前谢谢

列表项之间的行是分隔符。您可以使用XML轻松地删除这些内容;只需将以下内容添加到ListView:

        android:divider="@null"
        android:dividerHeight="0dip"
这将为您移除分隔器