6

I would like to achieve a navigation in my app like Pinterest or Trello, that is, kind of three tabs to navigation + horizontal scrolling. I have made a custom tabbar for this (since I couldn't guess how to change tabs width in my actionbar with navigation TAB mode). So I have three buttons to navigate from one fragment to another. Now I would like to implement the horizontal scrolling like these two examples, to also navigate among my fragments. I have read about View Pager but I don't know if it fits to my case, since I don't have only views but fragments. Does anybody have an example or an idea of how to do it? Could I apply it among different activities? Thanks

Ben Weiss
  • 17,182
  • 6
  • 67
  • 87
DroidBeginner
  • 135
  • 1
  • 3
  • 11
  • 1
    How about implementing [effective navigation](http://developer.android.com/training/implementing-navigation/index.html)? – gunar Sep 03 '13 at 14:14

2 Answers2

5

Please take a look at the duplicate question that I just answered:

How to implement a swipe-gesture between Fragments?

I suppose the Android ViewPager is what you are looking for:

http://developer.android.com/reference/android/support/v4/view/ViewPager.html

Here is a nice tutorial on how to implement it:

http://developer.android.com/training/animation/screen-slide.html

The basic idea is that you have multiple Fragments, each representing a different Screen. The ViewPager enables the user to swipe between the different Fragments and display different content.

Community
  • 1
  • 1
Philipp Jahoda
  • 50,880
  • 24
  • 180
  • 187
  • Thasnks, that is what I was seeing in my searching. But it will be compatible with my customTab Navigation? This is not a current actionBar with Tabs, but a custom actionbar with three buttons. – DroidBeginner Sep 04 '13 at 07:54
0

You can use ViewPager. More information about viewpager this.

getKonstantin
  • 1,220
  • 9
  • 14
  • 1
    I don't know how to mix both NavigationTab and ViewPager. I tried to add ViewPager and it works (although I don't know how to start in the middle position), but if I try to use Tabs it cracks. – DroidBeginner Sep 19 '13 at 08:38