Ali
Ali

Reputation: 2768

OnScrollChange does not fire for Webview

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?

Upvotes: 0

Views: 910

Answers (1)

Robbit
Robbit

Reputation: 4358

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??");
}

Upvotes: 2

Related Questions