代码之家  ›  专栏  ›  技术社区  ›  Hagbard

找不到xamarin.forms.forms.init()。

  •  0
  • Hagbard  · 技术社区  · 7 年前

    我正在努力 Oxyplot 与Xamarin一起运行Android应用程序。文件说明如下:

    初始化呈现器

    您需要通过添加以下内容来初始化oxyplot渲染器 仅在xamarin.forms.forms.init()之后调用:

    iOS (Unified API): OxyPlot.Xamarin.Forms.Platform.iOS.PlotViewRenderer.Init();
    Android: OxyPlot.Xamarin.Forms.Platform.Android.PlotViewRenderer.Init();
    Universal Windows: OxyPlot.Xamarin.Forms.Platform.UWP.PlotViewRenderer.Init();
    Windows Phone: OxyPlot.Xamarin.Forms.Platform.WP8.PlotViewRenderer.Init();
    

    提示:在解决方案中搜索__xamarin.forms.forms.init()_以查找 所有需要添加代码的地方。

    我在解决方案中搜索了“xamarin.forms.forms.init()”,但找不到该字符串。关于如何从这里开始以及如何让一个简单的oxyplot示例应用程序运行的任何提示?

    1 回复  |  直到 7 年前
        1
  •  1
  •   magicandre1981    7 年前

    呼叫 Xamarin.Forms.Forms.Init() 被调用 protected override void OnCreate 在里面 MainActivity.cs .

    [Activity(Label = "fooApp", Icon = "@drawable/icon", Theme = "@style/MainTheme", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation)]
        public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsAppCompatActivity
        {
            protected override void OnCreate(Bundle bundle)
            {
                TabLayoutResource = Resource.Layout.Tabbar;
                ToolbarResource = Resource.Layout.Toolbar;
    
                base.OnCreate(bundle);
    
                global::Xamarin.Forms.Forms.Init(this, bundle);
                OxyPlot.Xamarin.Forms.Platform.Android.PlotViewRenderer.Init();
                LoadApplication(new App());
            }
        }
    
    推荐文章