Fixed pages forgetting scroll position when switching tabs

This commit is contained in:
ByteHamster 2020-09-18 23:07:10 +02:00
parent 06315821d5
commit f3e3f9c4d1
2 changed files with 2 additions and 0 deletions

View File

@ -48,6 +48,7 @@ public class DownloadsFragment extends Fragment {
viewPager = root.findViewById(R.id.viewpager);
viewPager.setAdapter(new DownloadsPagerAdapter(this));
viewPager.setOffscreenPageLimit(2);
// Give the TabLayout the ViewPager
tabLayout = root.findViewById(R.id.sliding_tabs);

View File

@ -51,6 +51,7 @@ public class EpisodesFragment extends Fragment {
((AppCompatActivity) getActivity()).setSupportActionBar(toolbar);
viewPager = rootView.findViewById(R.id.viewpager);
viewPager.setAdapter(new EpisodesPagerAdapter(this));
viewPager.setOffscreenPageLimit(2);
// Give the TabLayout the ViewPager
tabLayout = rootView.findViewById(R.id.sliding_tabs);