0

I want to be able to scroll the webview until it has reached the end of the Webview. But the code below continues to scroll down automatically even when the webview page has reached to it's end. I want to make sure that each page scrolls down until the end of the webview.

webview.loadUrl("file:///android_asset/"+position+".html");
            webview.getSettings().setBuiltInZoomControls(true);
            webview.setPictureListener(new PictureListener() {

                public void onNewPicture(WebView view, Picture picture) {
                    int webBot = webview.getBottom();

                    webview.scrollBy(0, 1);
                }
            });
4

1 回答 1

0

试试这个,(基本上使用 onPageFinished() 而不是 onNewPicture())

       wv.setWebViewClient(new WebViewClient() {            
        @Override
        public void onPageFinished(WebView view, String url) {
             // TODO Auto-generated method stub
            super.onPageFinished(view, url);
            Log.i(TAG,"onPageFinished invoked!!");
            wv.scrollBy(0, wv.getBottom());
            }

    }); 
于 2013-05-10T22:44:27.077 回答