Android ListView滚动时背景颜色发生变化-colorCacheHint未修复问题

Android ListView滚动时背景颜色发生变化-colorCacheHint未修复问题,android,listview,background-color,Android,Listview,Background Color,所以我通过一个适配器使用一个定制的listview,在我的Nexus7上,一切看起来都很好,但是在我的HTC难以置信2上,我遇到了一个问题,我的背景颜色发生了变化。这是我的带有cacheColorHint集的XML文件。我也试过用#AA00000。有什么建议吗?我还尝试通过setCacheColorHint在活动中设置它,但没有任何效果 <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="

所以我通过一个适配器使用一个定制的listview,在我的Nexus7上,一切看起来都很好,但是在我的HTC难以置信2上,我遇到了一个问题,我的背景颜色发生了变化。这是我的带有cacheColorHint集的XML文件。我也试过用#AA00000。有什么建议吗?我还尝试通过setCacheColorHint在活动中设置它,但没有任何效果

 <?xml version="1.0" encoding="utf-8"?>
 <LinearLayout
 xmlns:android="http://schemas.android.com/apk/res/android"
 android:orientation="horizontal"     
 android:layout_width="fill_parent"
 android:layout_height="fill_parent"
 android:padding="10dp"
 android:background="#AA000000"
 android:cacheColorHint="#00000000">

 <ImageView android:id="@+id/ExhibitListIcon"
 android:contentDescription="Exhibit List Icon"
 android:layout_width="wrap_content"
 android:layout_height="fill_parent"
 android:gravity="center_vertical"
 android:layout_marginRight="15dp"
 android:layout_marginTop="5dp"
 android:layout_marginBottom="5dp" />

 <TextView android:id="@+id/ExhibitListTitle"
 android:layout_width="fill_parent"
 android:layout_height="fill_parent"
 android:gravity="center"
 android:textStyle="bold"
 android:textSize="22dp"
 android:textColor="#FFFFFF"
 android:layout_marginTop="5dp"
 android:layout_marginBottom="5dp" />

 </LinearLayout>

能否尝试在声明Listview的xml中设置cachecolorhint,而不是LinearLayout:

在布局文件中,使用:

android:cacheColorHint="#0000"
或者在java代码中,使用

listView.setCacheColorHint(Color.TRANSPARENT);

希望这有帮助

在列表视图中添加以下行:

listView.setCacheColorHint(Color.TRANSPARENT);

android:cacheColorHint=“@android:color/transparent”

成功了!非常感谢。哇,这对我来说是一个使用兼容性导航抽屉列表的问题,但只是旧设备上的问题,我不知道发生了什么!谢谢:-)