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 :
Sample UI : As there is divider between Instagram sizes ans Facebook sizes
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.
After some more google targeted search able to find one solution:
Two view holder for different views.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.