How to implement a ViewPager with different Fragments?

1.6k views Asked by At

I've follow a tutorial for use ViewPAger widget and implement swiping view for navigate to my app. Every tutorial i've follow use justo one simple static xml file to show in each tab (i just modify a textview). I need to create a different view with different content and swipe it. How can i do?

1

There are 1 answers

4
Philipp Jahoda On BEST ANSWER

I am not sure if I understand your question correctly, but I think this is what you are looking for:

How to implement a ViewPager with different Fragments / Layouts

The basic idea is that you have a different Fragment class for each different layout you have. In this case, all Fragments have a TextView, but their layouts also differ in a separate background color.