How to prevent the line from losing the color reference in the ExpandableListView?

0

I have an ExpandableListView with 5 groups and each group has its children (Child). I changed the background color of some kids, however when I use the scroll mess all the lines, painting everything. This happens because of the listView's recycle, when I'm using a simple listView I override the getViewType and getViewTypeCount methods and solve my problem. In expandable, they have methods getChildType and getChildTypeCount , but it is not working. Has anyone worked with these two methods in expandable and can give a help? Thank you in advance.

    
asked by anonymous 21.06.2016 / 20:38

1 answer

1

Speak Daniel,

Place your code here, it's best to help you.

But probably your problem is that you make an IF to color the lines right?

So you need to put an ELSE to the default color, example:

if(filho == filho){
   //cor da linha muda
}else{
   //cor da linha padrão
}

This is because you are using RecyclerView and as the name says, it recycles the already used cells to create a new one.

Hugs.

    
21.06.2016 / 20:48