Подтвердить что ты не робот

Во время прокрутки мои фоны ListView становятся черными - как исправить?

Ive задал белый фон для почти всех виджетов, и он работает, за исключением случаев прокрутки. Фоновый контейнер становится черным во время прокрутки, что приводит к раздражающему мерцанию.

4b9b3361

Ответ 1

Вам нужно будет использовать метод setCacheColorHint() ListView.

Пример: list.setCacheColorHint(yourBackColor);

Объяснение проблемы и решения здесь

Ответ 2

ScrollingCache = "false" в вашей деятельности *. XML файл для объекта списка тоже должен сделать трюк.

Ответ 3

Просто поместите фон сверху и без подсветки или других плохих эффектов просто и без необходимости подсказки или кеша в макете списка android:background="#000000" для черного фона или android:background="#FFFFFF" для белого

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="#000000"
    android:orientation="vertical" >
    <TextView
        android:id="@+id/testscheck"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="12dp"
        android:layout_marginBottom="12dp"
        android:layout_weight="1"
        android:layout_gravity="left|center"
        android:gravity="left"
        android:textColor="@color/ics"
        android:textSize="14sp"
         />
</LinearLayout>

Ответ 4

Я исправил эту проблему, сделав фоновый цвет ячеек того же цвета, что и ListView, поэтому:

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

    <ListView 
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:background="#FFFFFF"> <---- Background color of ListView
    </ListView>
</LinearLayout>

а затем строка:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:padding="8dip"
    android:background="#FFFFFF"> <--- Background color of the cell

    <LinearLayout 
        android:id="@+id/projects_cover_row_image_layout"
        android:layout_width="wrap_content"
        android:layout_height="fill_parent"
        android:layout_alignParentLeft="true"
        android:background="#444444"
        android:layout_centerInParent="true"
        android:layout_marginRight="8dip">

        <ImageView 
            android:id="@+id/projects_cover_row_image"
            android:layout_width="50dip"
            android:layout_height="50dip"
            android:contentDescription="@string/projects_image_content"/>
    </LinearLayout>

    ...

</RelativeLayout>

который полностью избавился от этой проблемы для меня и кажется лучшим решением