0

I have been looking for this all day. And I've have read through the Android Developer references aswell.

I would like the following structure in my xml.

<LinearLayout>
    <fragment />
    <fragment />
</LinearLayout>

The following LinearLayout shall be ONE PAGE. The problem here is that FragmentPageradapter wants ONE fragment in return, I the screen to include TWO Fragments.

Is this even possible? There is no documentation on it in on Android Developer. The closest thing is the Dynamic UI however that has nothing to do with including a FragmentPageradapter.

1 Answer 1

0

As of API 17 (and backported in the support library), there is getChildFragmentManager() in the Fragment class. This lets a Fragment contain Fragments. So, one option here is to create a parent Fragment that sets up the layout with two child Fragments. Then the FragmentPagerAdapter only needs to know about the parent.

A second option would be to create your own customer PagerAdapter that has unique knowledge of how to handle your desired layout.

Sign up to request clarification or add additional context in comments.

1 Comment

I opted for the custom pager adapter, however I seem to fail at inflating my fragments. But thats another case!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.