I have a RecyclerView
in a Fragment
which again is in a ViewPager
, when I swipe between ViewPager
pages, I see that onDetach
of Fragment
is being called but for some reason RecyclerView
is still present in that particular position for the Fragment
in ViewPager
, even the scroll position of RecyclerView
is being preserved when I come back to the detached Fragment.
I am using FragmentStatePagerAdapter
for ViewPager
and I am returning POSITION_NONE
from getItemPosition()
but it has no effect.
Please help me understand the problem here.