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

Asked

Viewed 24 times

0

I have an Expandablelistview with 5 groups and each group has their children (Child). I changed the background color of some children, but when I use the scroll mess all the lines, painting everything. This happens because of listview Recycle, when using a simple listview I overwrite the methods getViewType and getViewTypeCount and solves my problem. In Expandable have the methods getChildType and getChildTypeCount, but it’s not working. Has anyone worked with these two methods on Xpandable and can you help? Thanks in advance.

1 answer

1


Fala Daniel,

Put your code here, it’s better to help you.

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

So you need to put a ELSE for standard 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 cells already used to create a new.

Hugs.

  • I had already had this problem with listview long ago and this solution had not worked, but with Xpandable it worked. Thanks. Hugs.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.