标签:
原文: 从零开始学Xamarin.Forms(四) Android 准备步骤(添加第三方Xamarin.Forms.Labs库)
添加变量:private static bool _initialized;修改MainActivity集成自:XFormsApplicationDroid添加方法:
private void SetIoc() { var resolverContainer = new SimpleContainer(); var app = new XFormsAppDroid(); app.Init(this); resolverContainer.Register<IDevice>(t => AndroidDevice.CurrentDevice) .Register<IDisplay>(t => t.Resolve<IDevice>().Display) .Register<IDependencyContainer>(resolverContainer) .Register<IXFormsApp>(app); Resolver.SetResolver(resolverContainer.GetResolver()); _initialized = true; }
if (!_initialized) { this.SetIoc(); }
从零开始学Xamarin.Forms(四) Android 准备步骤(添加第三方Xamarin.Forms.Labs库)
标签:
原文地址:http://www.cnblogs.com/lonelyxmas/p/4499452.html