In list extra spaces added between items, while loading the data from web service.
dhara95 opened this issue · comments
I have implemented your library in my project which is written in java language. In my project there is need to call data from web service so 1st time when I call web service at that time data properly shown but when I call web service 2nd time for more data at that time data is displayed in the list with extra space in between the items, extra space in between items and headers as well as width of the item is also changed which is shown in below picture.
Can you help me to solve this problem
Thanking you in advance
Properly shows data when 1st time I call data from web service
Extra spaces is added in list when 2nd time I call data from web service
@dhara95
Could you show me the code implemented in RecyclerSectionItemDecoration.SectionCallback?
private RecyclerSectionItemDecoration.SectionCallback getSectionCallback(List finalLeadsMapMarkersList) {
return new RecyclerSectionItemDecoration.SectionCallback() {
//In your data, implement a method to determine if this is a section.
@OverRide
public boolean isSection(int i) {
return !finalLeadsMapMarkersList.get(i).getDateGroup().equals(finalLeadsMapMarkersList.get(i - 1).getDateGroup());
}
//Implement a method that returns a SectionHeader.
@Override
public SectionInfo getSectionHeader(int i) {
return new SectionInfo(finalLeadsMapMarkersList.get(i).getDateGroup(), "");
}
};
}
for me too making swipe filling the list.
I had the same problem, because everytime I loaded new data I added the item decoration for my new List. As a workaround I remove the old item decoration with:
int count = tlRecyclerView.getItemDecorationCount();
if (count > 0)
tlRecyclerView.removeItemDecorationAt(count - 1);
Now everythings works as expected
Was not it the case comment above?
Did you solve the issue in another way?
I had the same problem, because everytime I loaded new data I added the item decoration for my new List. As a workaround I remove the old item decoration with:
int count = tlRecyclerView.getItemDecorationCount(); if (count > 0) tlRecyclerView.removeItemDecorationAt(count - 1);
Now everythings works as expected
it is useful for me
Perhaps the library should have a method to clear the whole list? or notify of a new dataset?