I am seeing some very weird behavior with a set of ListViews that I have in a single Activity.
I have 5 ListViews that make up a custom control that acts like a lock combination on a briefcase. Al开发者_运维问答l 5 of these have transparent backgrounds and they are overlaid on top of their background using a RelativeLayout.
Every once and a while, all 5 of the ListView backgrounds will be filled with a drawable png image that I have on the same Activity. When this image shows up, there are no elements in the ListViews like their should be. I usually clean the project and push it back onto the phone which fixes the problem. However, I am trying to figure out if the issue will happen whether or not it worked out of the box.
I am not sure if the ListView is being entirely replaced by the drawable. I DO know that there are never any elements in the ListViews when the issue occurs.
What would cause the issue of an image resource showing up as the ListView, instead of the ListView and their contents?
Update: I thought this could be resolved by cleaning/rebuilding the project, however I'm now finding out that this problem occurs during run-time.
After replace an image on the home screen, I found that the image being incorrectly loaded into the ListView is actually from another Activity.
If I used my own transparent #00000000
color for the android:divider
of the ListView
, I would see this issue.
The fix was to use @android:color/transparent
instead, and the behavior corrected itself.
If the image is the background of a parent element in your layout XML, then it will show up when your lists are empty.
Alternatively, does your ListView specify an empty image to be displayed when there are no elements in the list?
精彩评论