Scenario :
I am trying to add the section between items in the recycler view. This divider is not with every element but it is based on the datasource. My Datasource has a divider property for that cell it means it is a divider cell and a divider of 2dp*100dp
need to be shown in place of the normal cell data.
WorkDone : I tried to do that using two sibling inside the my recycler-view main cell-view which will be passed to the holder. In one sibling there is my main cell layout and in another one just the separator view and based on the datasource while binding I am changing the visibility of the each sibling. But I am facing that while scrolling back and forth multiple separator and coming at random placed and keep on increasing while scrolling.
Question:
- Is this is correct way to achieve desired result ?
- What am i doing wrong ( fix for this ?)
Sample UI : As there is divider between Instagram sizes ans Facebook sizes
CodePudding user response:
If you implement these scenario (having two types of holders) in a right way, i think it's the best way to achieve your goal.
CodePudding user response:
After some more google targeted search able to find one solution:
Two view holder for different views.