Skip to content Skip to sidebar Skip to footer

Viewpager With Navigationdrawer

i'm trying to implement fragments with and without viewpager inside a navigation drawer. here's what I'm trying to achieve: 1) an app with navigation drawer, with 3 menus: dashboar

Solution 1:

am also working on same requirement here is my demo code hopefully it will help you in your development phase

i was also stucked almost a day then after so much of research finally i tackled the issue and achieved which i want

https://www.dropbox.com/s/jc4tb636qr3vfc7/vikrant_pager_tabstrip.zip

Solution 2:

The part you are having trouble with is that you want some of your top-level Fragments, namely ExpensesFragment and IncomeFragment, to use more fragments for the pages of the ViewPager (since you've already defined a FragmentPagerAdapter implementation).

When you instantiate the FragmentPagerAdapter, you give it a FragmentManager. I believe you need to use getChildFragmentManager() in the top-level Fragment, for example like so:

@OverridepublicvoidonViewCreated(View view, Bundle savedInstanceState) {
    MyPageAdapteradapter=newMyPageAdapter(getChildFragmentManager());
    viewPager.setAdapter(adapter);
}

This will provide a FragmentManager instance specific to this particular Fragment and used for managing nested fragments.

Post a Comment for "Viewpager With Navigationdrawer"