So I'm using a custom listview through an adapter, and on my Nexus 7 everything looks great, but on my HTC Incredible 2 I'm running into an issue where my background color changes. Here's my XML file with the cacheColorHint set. I've also tried with #AA00000. Any suggestions? I also tried setting it in the activity via setCacheColorHint, but nothing's working yet.
<?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>
Could you try setting the cachecolorhint in the xml where the Listview is declared, instead of the LinearLayout :
At layout file, use:
android:cacheColorHint="#0000"
OR at java code,use
listView.setCacheColorHint(Color.TRANSPARENT);
Hope this helps!!
Add below line to your listview:
android:cacheColorHint="@android:color/transparent"
listView.setCacheColorHint(Color.TRANSPARENT);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With