我们必须在 Android 中的 MvvmCross 中初始化 Xamarin.Forms 吗?
do we have to initialize Xamarin.Forms in MvvmCross in Android?
我在 MvvmCross
中有一个简单的示例。在那里,我安装了 Xamarin.Forms version 3.4
和 MvvmCross version 6.6.
我的疑问是:
- 初始化这段代码的目的是什么
global::Xamarin.Forms.Forms.Init(this, bundle) in android Renderer ?
- 我们是否必须在 android 渲染器中的 MvvmCross 版本 6.6 中初始化 Xamarin.Forms?
What is the purpose of initializing this code global::Xamarin.Forms.Forms.Init(this, bundle)
in android renderer?
如果你检查 Xamarin.Forms
official quote on this 它是这样的:
The OnCreate override initializes the Xamarin.Forms
framework by calling the Init method. This causes the Android-specific implementation of Xamarin.Forms
to be loaded in the application before the Xamarin.Forms
application is loaded. In addition, the MainActivity
class stores a reference to itself in the Instance property. The Instance property is known as the local context
and is referenced from the PhoneDialer class.
引用是不言自明的,但只是为了帮助您一点点,它基本上用于加载 Xamarin.Forms 框架在运行时需要的 Android 特定实现。
do we have to initialize Xamarin.Forms in MvvmCross version 6.6 in android renderer?
不,您不需要在 MvvmCross 中初始化它,因为 MvvmCross 会在后台为您完成。有关如何为 Xamarin.Forms 设置 MvvmCross 的更多信息,请查看 this
我在 MvvmCross
中有一个简单的示例。在那里,我安装了 Xamarin.Forms version 3.4
和 MvvmCross version 6.6.
我的疑问是:
- 初始化这段代码的目的是什么
global::Xamarin.Forms.Forms.Init(this, bundle) in android Renderer ?
- 我们是否必须在 android 渲染器中的 MvvmCross 版本 6.6 中初始化 Xamarin.Forms?
What is the purpose of initializing this code
global::Xamarin.Forms.Forms.Init(this, bundle)
in android renderer?
如果你检查 Xamarin.Forms
official quote on this 它是这样的:
The OnCreate override initializes the
Xamarin.Forms
framework by calling the Init method. This causes the Android-specific implementation ofXamarin.Forms
to be loaded in the application before theXamarin.Forms
application is loaded. In addition, theMainActivity
class stores a reference to itself in the Instance property. The Instance property is known as the localcontext
and is referenced from the PhoneDialer class.
引用是不言自明的,但只是为了帮助您一点点,它基本上用于加载 Xamarin.Forms 框架在运行时需要的 Android 特定实现。
do we have to initialize Xamarin.Forms in MvvmCross version 6.6 in android renderer?
不,您不需要在 MvvmCross 中初始化它,因为 MvvmCross 会在后台为您完成。有关如何为 Xamarin.Forms 设置 MvvmCross 的更多信息,请查看 this