Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android - Remove CacheColorHint for ListView

I am developing Android Application having the listview in an activity. I implemented the listview in an activity. By default, while scrolling the list, the background of the entire list changes to black. So, i had given this parameter: android:cacheColorHint = "#000000".

Now while going to the end of the list a white background is showing at the end.

So, here my question is

How to remove the cacheColorHint, showing only the activity's background instead of color?.

Please help me with the Links/SampleCode.

like image 844
Avadhani Y Avatar asked Nov 01 '11 06:11

Avadhani Y


3 Answers

You can use:

android:cacheColorHint="@android:color/transparent"
like image 67
Paresh Mayani Avatar answered Oct 20 '22 11:10

Paresh Mayani


At layout file, use:

android:cacheColorHint="#0000"

and at java code,use

listView.setCacheColorHint(Color.TRANSPARENT);
like image 38
Nguyen Minh Binh Avatar answered Oct 20 '22 10:10

Nguyen Minh Binh


i have done something like this i have no issue

<ListView 
   android:layout_height="wrap_content" 
   android:id="@+id/listView"
   android:layout_width="match_parent" 
   android:cacheColorHint="#00000000" 
   android:divider="#00000000"/>

try color code #00000000

like image 25
ud_an Avatar answered Oct 20 '22 11:10

ud_an