Search code examples
androidandroid-listviewandroid-listfragment

Duplication of listview rows in list fragment on orientation change


I have a ListFragment where I use a custom adapter to populate the listview. All is well until I change orientation and scroll. Then it looks like this: ListView after a few orientation changes

I am guessing it has something to do with me fumbling with a view holder, but I can't access the code right now.


Solution

  • The reason for the overlapping fragment was that I used FrameLayout and added the fragment with FragmentTransition.add(...). When I changed .add() to .replace() the old fragment was removed and the new one was added and my problem was solved.