0

I think I am doing something wrong here,

I added WebView.IOnScrollChangeListener in my activity

MainActivity : Activity, WebView.IOnScrollChangeListener

Then created an interface in the same activity

void WebView.IOnScrollChangeListener.OnScrollChange(View v, int scrollX, int scrollY, int oldScrollX, int oldScrollY)
  {
    Log.Info("101028", "scrolled??");
  }

Then I set the OnScrollChangeListener on my WebView

webView.SetOnScrollChangeListener(this);

The issue is, void WebView.IOnScrollChangeListener.OnScrollChange never fires

I also tried the following, but this also does not work

webView.ScrollChange += (o, e) => { Log.Info("101028", "scrolled??"); };

any idea what am I doing wrong here?

Ali
  • 2,702
  • 3
  • 32
  • 54
  • 1
    https://stackoverflow.com/questions/14752523/how-to-make-a-scroll-listener-for-webview-in-android – SushiHangover May 04 '18 at 03:40
  • Hi, I saw that but the initial step is to extend the activity with WebView and when I do that in Xamarin I get the error `public class MainActivity : Activity, WebView` -- `can not have multiple base classes` which does make sense – Ali May 04 '18 at 03:46
  • Oh Wait... I think i am reading it wrong – Ali May 04 '18 at 03:47

1 Answers1

2

public class MainActivity : Activity, WebView -- can not have multiple base classes

There should be only one base class Activity, you can't inherit two class, the WebView should be an interface: View.IOnScrollChangeListener, and then implement the method:

public void OnScrollChange(View v, int scrollX, int scrollY, int oldScrollX, int oldScrollY)
{
    Log.Info("101028", "scrolled??");
}
Robbit
  • 4,300
  • 1
  • 13
  • 29