1

I'm trying to implement a navigation like in Play Store app or in the VLC app.

In the Play Store app, they use a navigation drawer where you can choose 'apps'. Then it is possible to swipe through 'views' (categories, home, top paid, ...) ( here is a picture to show what I'm talking about)

In the VLC app, they use a navigation drawer (?) in combination with a swipe view (?) for the audio section.

I was searching for a tutorial, but I couldn't find any suitable yet. Most of these tutorials use Fragment's - as far as I know, these aren't able to contain swipe views?

Could someone please give me a hint (in addition it would be nice to see some code) on how to get on with this? Thanks :)

Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62

3 Answers3

0

Look into latest design support library, specifically for TabLayout, where you can specify fixed tabs (up to three usually), or swiping ones (many more).

http://android-developers.blogspot.co.uk/2015/05/android-design-support-library.html

There's also an awesome demo of it in an open source app called Cheesesquare.

https://github.com/chrisbanes/cheesesquare

TomaszRykala
  • 927
  • 6
  • 16
  • 33
0

A FrameLayout hosting a ViewPager could be used to achieve this. Just use a LinearLayout at the top of the layout to display your navigation buttons.

The ViewPager will allow the user to swipe through each fragment it contains, you can also set each button's onClick to have the ViewPager automatically swipe to the relevant fragment.

PaulyC
  • 139
  • 7
0

If you want to use TabLayout, look into Google I/O app on github. More specifically, take a look at SlidingTabLayout and SlidingTabStrip under iosched/android/src/main/java/com/google/samples/apps/iosched/ui/widget. Also take at look at this SO thread

Community
  • 1
  • 1