I have a Navigation Drawer in which there is one snippet for a Tab Viewer . In tabviewer, I use ViewPager , which is also in Fragment . Code for ViewPager -
viewPager = (ViewPager) rootView.findViewById(R.id.pager); viewPager.setAdapter(new TabsPagerAdapter(((FragmentActivity)getActivity()).getSupportFragmentManager())); PagerSlidingTabStrip tabsStrip = (PagerSlidingTabStrip) rootView.findViewById(R.id.tabs); tabsStrip.setViewPager(viewPager);
Tabs are displayed in the first click in the navigation box with its contents, but the second time the only name of the tabs goes without its layout. The layout doesnโt fit and the swipe also doesnโt work between different tabs? Why is it working for the first time, but not for the rest? I attach images for two different clicks on the same fragment of the navigation box. This is the first click, so the layout fits perfectly. 
This is in the second attempt to click on the same fragment, but only the background image comes out without the contents of the layout.

Help get rid of this problem.
source share