嗨,我一直在尝试使用带有底部导航栏的滑动选项卡,但是在重新选择选项卡时,滑动缺少并且没有任何显示。我正在从底部栏片段中调用滑动标签的片段。这是我的代码
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;
}
}