Android: ListView Flicker effect. Any hints on how to get rid of this?

Legend picture Legend · Oct 7, 2009 · Viewed 8.2k times · Source

For some reason, whenever I scroll through my list of items, the background inside my listview disappears and reappears giving rise to a "flicker" effect which I don't really want. I've tried the suggestion at: How to make a ListView transparent in Android? but it doesn't work for some reason. Any suggestions?

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/screenLayout"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:background="@drawable/background"
    >
        <TextView
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:gravity="center"
            android:background="@color/title_background"
            android:text="@string/whatsnew_title"
            >
        </TextView>
        <ListView
            android:id="@android:id/list"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            >
        </ListView>     
</LinearLayout>

Answer

mernen picture mernen · Oct 9, 2009

Did you include android:cacheColorHint="#00000000"? It's the most important part of the proposed fix. I've just tried your code (obviously not an exact reproduction, as you're using references to project-specific resources) with it, and it seems to work.

This post on the Android Developers blog should be of your interest.