문제

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

도움이 되었습니까?

해결책

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.

다른 팁

You can use ViewPager. More information about viewpager this.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top