[英]ViewPager not for all activity fragments
So I saw on an android developer site the example implementation of a ViewPager. 因此,我在android开发人员网站上看到了ViewPager的示例实现。 I saw that ViewPager must be set in an activity class.
我看到必须在活动类中设置ViewPager。 My application has only one Actvity with about 15 Fragments.
我的应用程序只有一个Actvity,带有大约15个片段。 The thing I want to do is to use ViewPager only for 3 Fragments, for example:
我想做的是仅对3个片段使用ViewPager,例如:
Is this even possible with only one Activity containing these all fragments? 仅包含所有这些片段的一个活动,甚至可能实现吗? I will be grateful for any kind of hints.
我将不胜感激。
PS: If that is gonna be helpful answering my question, this is how I switch between fragments now: PS:如果那将有助于回答我的问题,这就是我现在如何在片段之间切换:
MealInfoFragment fragment = new MealInfoFragment();
FragmentTransaction fragmentTransaction = getFragmentManager().beginTransaction();
fragmentTransaction.setCustomAnimations(R.anim.enter_from_right, R.anim.exit_to_left, R.anim.enter_from_left, R.anim.exit_to_right);
fragmentTransaction.replace(R.id.fragment_container, fragment);
fragmentTransaction.addToBackStack(MainActivity.currentFragment);
fragmentTransaction.commit();
仅作记录,我通过在包含其他3个片段的片段中创建viewpager来做到这一点!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.