0

Swipe views provide lateral navigation between sibling screens such as tabs with a horizontal finger gesture (horizontal paging). If I use ViewPager where each child view is a separate page (a separate tab) in the layout for 5 major modules in the app, will that create any problems? I ask because this method is really intended for dividing small blocks of content within an app. Is there any problem using this as the primary mode of navigation for the entire app where each "tab" in the ViewPager is a giant module?

lurning too koad
  • 2,698
  • 1
  • 17
  • 47
  • 1
    I would not recommend this architecture, this is not what ViewPagers are really meant for. For info on the major roadblock you would run into, see here: http://stackoverflow.com/questions/7723964/replace-fragment-inside-a-viewpager – Daniel Nugent Mar 11 '16 at 23:00
  • @DanielNugent Thanks for the link. Architecturally, then, what approach would you recommend? We want to horizontally navigate between 5 large modules (like the Snapchat interface) like they were tabs. – lurning too koad Mar 11 '16 at 23:05
  • 1
    I just opened up SnapChat and took a look. I would say use a two Activity architecture. The first Activity holds the ViewPager and all of the top level Fragments, and the second Activity holds a FrameLayout for showing Fragments using FragmentTransactions. If the user navigates into a sub-level of navigation, start the second Activity and load whatever Fragment you need to using a FragmentTransaction. – Daniel Nugent Mar 11 '16 at 23:11
  • @DanielNugent So I looked into this approach and think... you are a genius. Thanks a million! – lurning too koad Mar 11 '16 at 23:51

0 Answers0