解决Android的ListView控件滚动时背景变黑

如果大家在非黑色背景下使用ListView控件时,Android默认可能在滚动ListView时这个列表控件的背景突然变成黑色。这样可能导致程序的黑色的背景和主程序的主题既不协调。解决的方法Google在设计Android时也考虑了,在Layout的ListView中加入android:cacheColorHint="#00000000" 的属性即可。

如:

<?xml version="1.0" encoding="utf-8"?>
<ListView xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/comList"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:background="@color/white"
   android:cacheColorHint="#00000000" >

</ListView>
原文地址:https://www.cnblogs.com/wangsx/p/2453510.html