Android: FragmentActivity inside FragmentActivity (ScrollView in NavigationBar)
Asked Answered
M

1

1

I have a FragmentActivity which can swipe through several fragments via ViewPager and a FragmentActivity which hosts an ActionBar for navigation.

Now I want to nest the FragmentActivity with the ViewPager in the first fragment of the other FragmentActivity which hosts the ActionBar.

In other words I like to have an ActionBar navigation and in it's first Tab I'd like to have swipeable fragments.

My problem is how to nest one FragmentActivity in another FragmentActivity. Both work on their own but I don't get them to work together.

Millepede answered 1/8, 2012 at 14:28 Comment(1)
Thanks for the answer. But how can I have swipeable fragment inside a tab of an ActionBar?Millepede
P
0

Swipe Gesture applied at Fragment level along with ViewPager with it's default swipe disabled

You can write your own touch interceptor for the fragments inside your view-pager.

However on a second opinion, please see my moqup in the question:

You can have several ViewGroup container preferably FrameLayout, where on each you can add or remove fragments using transactions. The container of the Navigation Panel is different than where the ViewPager is showing:

Keep this ViewPager in a separate fragment that spawns in yet another FrameLayout. in ViewPager here you should not use the FragmentPageAdapter, but a regular PagerAdapter (avoid nesting of fragments). Hence the ViewPager is a parent container for the Views, and not Fragments where they are shown.

The target of the navigation drawer (on item click) will be this second FrameLayout. Keep it simple!!

Similarly you can have a ViewPager inside a first tab of Tab based ViewPager with this new found information.

Presidentelect answered 24/10, 2013 at 5:32 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.