Wednesday, February 29, 2012

[android-developers] complex layout in expandableListView

Hi there am a noob in android and i already have a problem i can't solve
basically I have an expandableListView displaying a linearLayout in each groupView
this linearLayout is composed of a checkbox, image on the left, a central text, and 2 different images on the right
this layout is a custom class that varies depending on a statemachine
for exemple i have three different states that will remove / add the the different controls to the layout, on each state i will have only 3 controls displayed (left, center, right)
Mainly each state calls  removeAllViews() and adds the needed views back to the layout

on another place i have a model listing each listitem model, so everytime the getViewGroup() is called , i get the corresponding model and apply the corresponding state (store with a single int in the model)
Here are the different problems I have:

The childView (only one by group) displays a text 

- everything works fine if i scroll up/down but after changing the state of some item, it appears that removed views can appear on the item, or worse, they can appear on other item...
the button on the right is also displayed but only half of it is visible... well it goes really wrong !
- after that if i click a group whitch is a mess, displaying the clhild resolves the problem ...until i close it...
- the childView is shown even though the description is empty, i 'd like to hide it but whatever i try like set its height to 0 or visibility to GONE doesn t work
if the getChildView() returns null, the program crashes...i don't see any solution

any idea? 
Do you have a better way to develop a listView with changing items?

I have been searching for days seems i cannot figure out what is wrong

Fabien (sorry for my english)

You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to
To unsubscribe from this group, send email to
For more options, visit this group at

No comments:

Post a Comment