2011-01-15 4 views
1

weiß jemand, wie man schwarze Reihen in ListView loswird, bitte werfen Sie einen Blick auf den Screenshot.Wie man schwarze Reihen im ListView-Layout loswird

alt text

Die XML für jede Zeile:

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

<LinearLayout 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    android:id="@+id/list_view"> 

    <RelativeLayout 
     android:id="@+id/r_layout_for_tasks" 
     android:layout_width="fill_parent" 
     android:layout_height="fill_parent" 
     android:background="#ffffff"> 

     <ImageView 
      android:id="@+id/icon_image_view" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:src="@drawable/clock" 
      android:layout_alignParentLeft="true"> 
     </ImageView> 

     <TextView 
      android:id="@+id/task_text_view" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:paddingLeft="10dp" 
      android:layout_toRightOf="@id/icon_image_view"> 
     </TextView>  

     <TextView 
      android:id="@+id/time_text_view" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_alignParentRight="true"> 
     </TextView> 

    </RelativeLayout> 
</LinearLayout> 

Das Layout der Aktivität:

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    android:orientation="vertical" 
    android:background="#ffffff"> 

    <RelativeLayout 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:padding="10dp" 
    android:background="#ffffff"> 

    <Button 
     android:id="@+id/ok_button" 
     android:onClick="onClickOKButton" 
     android:text="OK" 
     android:layout_width="wrap_content"   
     android:layout_height="wrap_content" 
     android:minWidth="60dp" 
     android:layout_alignParentRight="true"> 
    </Button> 

    <EditText 
     android:id="@+id/edit_text" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:hint="Task description" 
     android:layout_toLeftOf="@id/ok_button"> 
    </EditText> 

    </RelativeLayout> 

<ListView 
    android:id="@+id/list_view"  
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    android:padding="10dp"> 
</ListView> 

</LinearLayout> 

Antwort

3

Werfen Sie einen Blick auf die android:divider Attribut in der XML-Layout festlegen. Sie können es auf die gleiche Farbe wie den Listenansichtshintergrund einstellen.

+3

Alternativ setzen Sie einfach 'android: divider =" @ null "', um es vollständig zu beseitigen. – kcoppock

0

Sie können Höhe und Farbe für die Teilereigenschaft von listview festlegen.

3

Hallo, Sie können die Höhe und Farbe des Listview-Separators ändern.

<ListView 
    android:id="@+id/android:list" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:divider="#FFCC00" 
    android:dividerHeight="4px"/> 
Verwandte Themen