我使用了两个listview,就像这样:

<ListView
   android:id="@+id/ListView"
   android:text="@string/Website"
   android:layout_height="30px"
   android:layout_width="150px"
   android:scrollbars="none"
   android:transcriptMode="normal"/>
<ListView
   android:id="@+id/ListView1"
   android:text="@string/Website"
   android:layout_height="30px"
   android:layout_width="150px"
   android:scrollbars="none"
   android:transcriptMode="normal"/>

两个listview之间有一行空行。我怎么移除它?


当前回答

你可以把下面的属性放在listview标签中

android:divider="@null"

(或) 以编程方式listview.Divider(空); 这里的listview是listview引用。

其他回答

设置分隔符为空:

JAVA

  listview_id.setDivider(null);

XML

<ListView 
  android:id="@+id/listview"
  android:layout_width="match_parent"
  android:layout_height="match_parent"
  android:divider="@null"
  />

在XML:

android:divider="@null"

或者在Java中:

listView.setDivider(null);

你可以把下面的属性放在listview标签中

android:divider="@null"

(或) 以编程方式listview.Divider(空); 这里的listview是listview引用。

String txt = ((TextView) view).getText().toString(); adapter.remove (txt);

我发现在XML文件中实现它更容易,因为在具有数百行代码的类中跟踪代码行可能更困难。 对于XML,你可以使用“null”:

android:divider="@null"