gpt4 book ai didi

android - 如何使用带有底部导航的可滑动标签

转载 作者:行者123 更新时间:2023-11-29 19:24:28 25 4
gpt4 key购买 nike

enter image description here

您好,我一直在尝试使用带底部导航栏的滑动标签,但是在重新选择标签时滑动缺失并且没有任何显示。我正在从底部栏 fragment 中调用滑动选项卡的 fragment 。这是我的代码

    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;
}
}

最佳答案

使用 getChildFragmentManager() 而不是 getFragmentManager() 。参见 viewpager didnt show anything after change bottom navigation menu.我试过了,效果很好

关于android - 如何使用带有底部导航的可滑动标签,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41689894/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com