Как избавиться от черных строк в макете ListView

1

кто-то знает, как избавиться от черных строк в ListView, посмотрите на скриншот.

Изображение 174551

xml для каждой строки:

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

Схема действий:

<?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>
Теги:
listview

3 ответа

3
Лучший ответ

Посмотрите на атрибут android: divider для установки в макете XML. Вы можете установить его на тот же цвет, что и фон списка.

  • 3
    Либо просто установите android:divider="@null" чтобы полностью устранить его.
3

Привет, вы можете изменить высоту и цвет разделителя listview.

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

Вы можете установить высоту и цвет для свойства делителя списка.

Ещё вопросы

Сообщество Overcoder
Наверх
Меню