Prevent flickering when loading the screen and scrolling to a specific position

Purpose. I want to scroll the page (0.60) as soon as the webview loads the webpage. At a minimum, I want to prevent the flicker that I see when a web page finishes loading. Flicker Since webview loads the URL (e.g. wiki), the user can scroll to read the text. However, the webview automatically scrolls up when the download finishes. This does not happen in a standard browser. I am targeting API 8. (Old, but people still use this version).

Here is the code:

private class WebBrowserWebViewClient extends WebViewClient 
{   
    @Override
    public boolean shouldOverrideUrlLoading(WebView view, String url) 
    {
        Log.d(TAG, "Load URL");
        view.loadUrl(url);                                 
        return true;                
    }

    @Override
    public void onPageFinished(WebView view, String url) 
    {
        super.onPageFinished(view, url);

        Log.d(TAG, "Page Finished Loading");

        //Attempt scrollTo here does not work.
        view.scrollTo(0, 60);
    }            
}

I also created a picture listener.

mWebView.setPictureListener(new PictureListener()
{               
        @Override
        public void onNewPicture(WebView view, Picture picture) 
        {
            Log.d(TAG, "On New Picture called....Y is " + view.getScrollY());

                //Does not work because it is called multiple times         
                view.scrollTo(0, 60);
            }       
});

I also continue to progress

mWebView.setWebChromeClient(new WebChromeClient()
{
       @Override
       public void onProgressChanged(WebView view, int newProgress) 
       {
            super.onProgressChanged(view, newProgress);

            Log.d(TAG,"On PRogress Changed. New Prgoress = " + newProgress);
       }
});

, , , onPageFinished() , - URL-. OnNewPicture() URL- onPageFinsiehd(). OnProgressChanged() newProgress 100, . , onProgressChanged() 100 onNewPicture, - .

. - ?

. , .

+3

All Articles