WebView Loads Halfway Down the Page, How to Automatically go to Top of Page?

hexagodhexagod Member ✭✭✭

Hey all, I'm using WebView to create a viewer for a website. The problem is that when I click on links (using android phone), sometimes the link loads halfway down the page instead of loading the very top. I think what's happening is that the webview is remembering where it was on the last page and centering it's view there. For example, I have a subscription list of users and if I click on a subscription it will load their video page but at the same location as it was on the subscription page. Does anyone know how to justify to the top of page when links are clicked?

I'm not sure if it's because I'm using TabHost and ActionBar, but I have used that since the beginning and it doesn't seem like this was a problem until I updated to 8.0 android on my device.

here's my full code

thanks, in advance


  • jezhjezh Member, Xamarin Team Xamurai

    Sorry, I can't got what you meaning.Could you please post more details.

  • hexagodhexagod Member ✭✭✭

    I tried this... but it's not firing when the page load finishes

    public class HelloWebViewClient : WebViewClient
        public Activity WhatsOnActivity;
        public HelloWebViewClient(Activity WhatsOnActivity)
            this.WhatsOnActivity = WhatsOnActivity;
        [Android.Runtime.Register("onPageFinished", "(Landroid/webkit/WebView;Ljava/lang/String;)V", "GetOnPageFinished_Landroid_webkit_WebView_Ljava_lang_String_Handler")]
        public override void OnPageFinished(WebView view, String url)
            WebView subsWebView = (WebView)this.WhatsOnActivity.FindViewById<WebView>(Resource.Id.webViewSubs);
            view = subsWebView;
            url = subsWebView.Url.ToString();
            this.OnPageFinished(view, url);
            subsWebView.ScrollTo(0, 0);
  • hexagodhexagod Member ✭✭✭

    @jezh said:
    Sorry, I can't got what you meaning.Could you please post more details.

    When I click on links inside the WebView, the page loads halfway down instead of at the very top. Normally, when I'm browsing the web, all pages load at the very top (title) instead of the bottom.

Sign In or Register to comment.