开发者

How to get rid of black rows in ListView layout

does someone know how to get rid of black rows in ListView, please have a look on the screenshot.

How to get rid of black rows in ListView layout

The xml for each row:

<?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>

The activity'开发者_如何学JAVAs layout:

<?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>


Have a look at the android:divider attribute to set in the XML layout. You can set it to the same color as the listview background.


Hi you can change the listview separator height and color.

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


You can set height and color to divider property of listview.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜