user1549672
user1549672

Reputation: 486

ActionBar tabs in a fragment

I am attempting to make a tablet UI that implements a ViewPager within a ViewPager. I was wondering if there was a simple way to add tabbed navigation at the top of the fragment containing the inner ViewPager. What is the appropriate method to get the tabs?

Upvotes: 0

Views: 49

Answers (1)

blackcj
blackcj

Reputation: 3661

You can use this as a starting point:

https://gist.github.com/blackcj/5960698

You'll need a ViewPager, PagerTabStrip and FragmentPagerAdapter in addition to your app Activity and Fragments. The code from the MainActivity in the example can be moved into a Fragment. The PagerTabStrip will give you the navigation across the top.

More information here: http://developer.android.com/training/implementing-navigation/lateral.html

Upvotes: 1

Related Questions