I need to style ListView and can't figure out why It turns to black background when scroll.. I have ListView inside LinearLayout and that layout has Background set to image.
This is what I have for ListView:
<style name="MyListView" parent="@android:style/Widget.ListView">
<item name="android:listSelector">@drawable/selector_list_item</item>
</style>
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_enabled="false" android:state_focused="true"
android:drawable="@drawable/shape_list_item_normal" />
<item android:state_pressed="true"
android:drawable="@drawable/shape_list_item_pressed" />
<item android:state_focused="true"
android:drawable="@drawable/shape_list_item_normal" />
</selector>
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
<gradient android:startColor="#80ffffff" android:endColor="#80eff3ef" android:angle="45" />
<padding android:left="5dip" android:right="5dip" android:top="7dip" android:bottom="7dip"/>
</shape>
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
<gradient android:startColor="#80808080" android:endColor="#80eff3ef" android:angle="45" />
<padding android:left="5dip" android:right="5dip" android:top="7dip" android:bottom="7dip"/>
</shape>
When I apply MyListView style I don't see much happening. When I click on item - yes, I see gradient. When ListView stable - I see background as it should be from parent layout. When I scroll - I see black background, it's erasing parent's background. And I would be fine with that if I knew how to set it with something else..
Use the following property in the xml of listView:
android:cacheColorHint="@android: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