I have a listview
, when I scroll it, that time listview element background color changes to black. I tried couple of hours, but not getting solution.
I tried
android:cacheColorHint="@android:color/transparent"
or
android:cacheColorHint="#00000000"
set the
android:cacheColorHint
to the color you used as a background to the ListViewItem
In my case this works fine
<ListView
android:id="@+id/list"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_margin="1dip"
android:layout_weight="1"
android:background="#ffffff"
android:choiceMode="singleChoice"
android:cacheColorHint="@android:color/transparent"
android:scrollingCache="false"
android:fastScrollEnabled="true">
</ListView>
One of the developer says, you have to use these 2 properties compulsory..
android:cacheColorHint="@android:color/transparent"
android:scrollingCache="false"
You can use this code:
// you can use your color also
android:background="@android:color/transparent"
android:cacheColorHint="@android:color/transparent"
Both color should be same, then your problem will be solved.
Hope it will help you.
Add following attributes to your listview inside xml layout.
android:scrollingCache="true"
android:cacheColorHint="#ffffff"
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.