CustomPresenter : display tabs inside a fragment

RoroRoro FRMember
edited October 2017 in Xamarin.Android

Hello everybody,

I'm working with MvvmCross 5.2 and I'm trying to implement several navigation pattern for Android. I want to use Presenter as much as possible. The navigation I want to have is this one : I would like to have tabs navigation pattern (like the one in the Playground mvvmcross app), but instead of hosting it in an activity I would like to host it in a fragment.

I tried to use the property FragmentHostViewType but it didn't work. The presenter is not able to find the viewpager inside of the hosting fragment. Actually, the presenter search for the viewpage inside the hosting activity... My guess is that the hosting fragment is not yet visible and it's a problem.

I saw that Nested Fragment were supported but there's an exception thrown when we try to navigate to a nested fragment and the hosted fragment is not yet visible. So maybe what I try to achieve is not possible...

I also tried to create my own presenter extending MvxAppCompatViewPresenter. I registered two new presentation attributes : MvxTabLayoutInFragmentPresentationAttribute and MvxViewPagerFragmentInFragmentPresentationAttribute. I tried to mix the show action of a NestedFragment and MvxTabLayoutPresentationAttribute but with no success...

I'm running out of idea so it's why I'm asking for your help. Did you already try to implement such a navigation pattern ? Do you have some idea to achieve it ?

Thank you in advance.

Edit: maybe I could use something like pendingRequest. I saw that mvvmcross use a pending request to show a fragment which is not in the current activity. The requested fragment is saved in the pending request. Then the host activity is shown. Then the listener ActivityLifetimeListener_ActivityChanged is triggered. If there was a pending request we process it. The thing is : how could we implement a FragmentLifetimeListener_FragmentChanged ?


  • TomEsendamTomEsendam USMember

    I also want to know a solution. I need to put a fragment with tabs inside of a nav drawer. Which complicates things.

  • RoroRoro FRMember


    Any update on this issue ?

Sign In or Register to comment.