如何在4.0 MVVMCross片段导航的工作?片段、如何在、工作、MVVMCross

2023-09-06 23:42:55 作者:- 歲月蒼白,人顏老

由于新的升级我对如何与片段导航不知道。

Since the new upgrade I have no idea on how to navigate with fragments.

这里有很多code的被注释掉。如果我使用code被留下,这是行不通的。我得到未发现异常活动。我用同样的标题写在演示的例子。什么是我需要遵循创建一个成功的片段步骤?

A lot of code from here is commented out. If I use the code that is left, it doesn't work. I get the activity not found exception. I use the same headers as written in demo example. What are the steps I need to follow to create a succesful fragment?

推荐答案

新片段实际上是pretty直线前进。所有你需要做的就是使用 MvxFragmentAttribute 然后确保作为的第一个参数传递的类型 MvxFragmentAttribute 工具 IMvxFragmentHost ,以便它可以处理由 MvxFragments presenter

The new fragments are actually pretty straight forward. All you have to do is annotating your fragment classes with the MvxFragmentAttribute and then making sure that the type passed as the first argument of the MvxFragmentAttribute implements IMvxFragmentHost, so that it can handle the Open and Close methods used by the MvxFragmentsPresenter.

新的 MvxFragments presenter 将处理目前的顶级活动是否负责显示请求的片段或不和,如果它不是,它会显示片段前开始适当的活动。

The new MvxFragmentsPresenter will handle whether or not the current top Activity is responsible for showing the requested fragment or not and, if it isn't, it'll start the proper activity in before showing the fragment.