Hi, I have been trying to use swipe tab with bottom navigation bar, but on re-selection of tab swipe lacks and nothing shows. I am calling fragments of swipe tabs from bottom bar fragment. This is my code
public class WalletFragment extends Fragment {
private ViewPager viewPager;
private WalletTabsAdapter mAdapter;
PagerSlidingTabStrip wallettabs;
// Tab titles
public static WalletFragment newInstance(int instance) {
Bundle args = new Bundle();
args.putInt("input", instance);
WalletFragment fragment = new WalletFragment();
fragment.setArguments(args);
return fragment;
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.fragment_wallet, container, false);
// Initilization
viewPager = (ViewPager) rootView.findViewById(R.id.walletpager);
wallettabs = (PagerSlidingTabStrip) rootView.findViewById(R.id.wallettabs);
mAdapter = new WalletTabsAdapter(getFragmentManager());
viewPager.setAdapter(mAdapter);
wallettabs.setViewPager(viewPager);
/**
* on swiping the viewpager make respective tab selected
* */
return rootView;
}
}
Use getChildFragmentManager()
instead of getFragmentManager()
. See viewpager didnt show anything after change bottom navigation menu
. I've tried it and it work perfectly