views:

36

answers:

2

Hi,

I have four tabs each with a listview, I have set backgrounds for each of the four list views but when you scroll the list view goes black, I have followed advice from googling and have added android:cacheColorHint="#00000000" to the main layout file and added android:theme="@android:style/Theme.Dialog" to the main activity in the manifest file.

Problem is that when I do this I get a titlebar at the top of the screen that I dont want and when I try to add the no title bar code it wont work because I cant add the two styles within the same activity.

If I remove the dialog code the transparent listview goes black when scrolling again.

All I want is to make the listview transparent without having the titlebar, can anyone help with this???

A: 

android:cacheColorHint=#00000000 should do the trick. Where in your layout XML did you put it? It should go in ListView, for example:

<ListView
    ...
    android:cacheColorHint="#00000000"
    ...
/>
kcoppock
Problem is I have originally used a listview tutorial not a custom view so I cannot seem to add a listview element:
JonniBravo
when I do it crashes
JonniBravo
What does that even mean? You said your layout was in XML (main.xml, most likely). Your ListView already exists, just place the cacheColorHint inside the ListView you've already defined.
kcoppock
The listview was originally default and used the default list in android, it is pointing to the main xml but it is not identified by a id, so I cannot add it to a list view element, when I create a xml with a list view id and specify that in the code it force closes if I add it to the main xml it force closes. I think I might have to create a new custom list view to get this to work the way I need it too.
JonniBravo
No, you don't need to make a custom ListView. Edit your original post to include your XML file, because what you're saying isn't really making sense.
kcoppock
A: 

The Android Developers' blog had a post about that a while ago. According to their post "Why is my list black? An Android optimization", all you need to do is add the android:cacheColorHint="#00000000" attribute to the ListView element.

Brian