Xamarin android 'MainActivity' 没有实现接口成员

Xamarin android 'MainActivity' does not implement interface member

我正在 visual studio 中研究 xamarin android。我在我的 layout 中添加了一个 scroll view 并在其中放置了我的 linear layout 然后两个 plot views 其中有两个图表被初始化。 运行 应用程序出现以下错误

'MainActivity' does not implement interface member 'ViewTreeObserver.IOnScrollChangedListener.OnScrollChanged()'

下面是我的 xml 布局

<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/MainLayout_ScrollView1"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<LinearLayout
    android:orientation="vertical"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:minWidth="25px"
    android:minHeight="25px"
    android:id="@+id/linearLayout1">
    <OxyPlot.Xamarin.Android.PlotView
        android:layout_width="match_parent"
        android:layout_height="254.5dp"
        android:id="@+id/plotView1" />
    <OxyPlot.Xamarin.Android.PlotView
        android:layout_width="match_parent"
        android:layout_height="309.5dp"
        android:id="@+id/plotView2" />
</LinearLayout></ScrollView>

下面是我的主要 activity 代码,包括

using Android.App;
using Android.Content;
using Android.Runtime;
using Android.Views;
using Android.Widget;
using Android.OS;
using OxyPlot.Xamarin.Android;
using OxyPlot;
using OxyPlot.Axes;
using OxyPlot.Series;
using OxyPlot.Annotations;
using Java.Util;
using System.Linq;
using System.Collections.Generic;
[Activity(Label = "SampleChart", MainLauncher = true, Icon = "@drawable/icon")]
public class MainActivity : Activity  , ViewTreeObserver.IOnScrollChangedListener
{

    private static Toast _PageToast;
    protected override void OnCreate(Bundle bundle)
    {
        base.OnCreate(bundle);

        // Set our view from the "main" layout resource
        SetContentView (Resource.Layout.Main);

        PlotView view = FindViewById<PlotView>(Resource.Id.plotView1);
        PlotView view2 = FindViewById<PlotView>(Resource.Id.plotView2);

        view.Model = CreatePlotModel();
        view2.Model = CreatePlotModel2();

        ScrollView MainLayout_ScrollView1 = (ScrollView)FindViewById(Resource.Id.MainLayout_ScrollView1);
        MainLayout_ScrollView1.ViewTreeObserver.AddOnScrollChangedListener(this);
    }

public void OnScrollChange()
    {
        if(_PageToast !=null)
        {
            _PageToast.Cancel();
        }

        ScrollView MainLayout_ScrollView1 = ((ScrollView)FindViewById(Resource.Id.MainLayout_ScrollView1));

        double scrollingSpace = MainLayout_ScrollView1.GetChildAt(0).Height - MainLayout_ScrollView1.Height;

        if(scrollingSpace <= MainLayout_ScrollView1.ScrollY)
        {
            _PageToast = Toast.MakeText(this, "You have reached to the bottom", ToastLength.Short);
            _PageToast.Show();
        }
        else
        {
            //Do things here 
        }
    }

波纹管是我得到的图像 underlined red mark

非常感谢任何帮助

您的 activity 必须实施方法 OnScrollChanged,但它没有。它只有OnScrollChange(最后缺少d:onScrollChanged