Android: ListView Flicker effect. Any hints on how to get rid of this?
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
开发者_如何学JAVA 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>
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.
This can also be achieved from Java (code) side: listView.setCacheColorHint(Color.TRANSPARENT);
Check your theme.xml for <item name="android:windowBackground">@null</item>
. If you have it - remove it. I think one of the popular resources gives this line as example (that's how I got mine).
精彩评论