当停止web视图是在最后 [英] Stop when WebView is at the end

查看:106
本文介绍了当停止web视图是在最后的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望能够滚动web视图,直到它已经到达web视图的结束。但是,code以下继续向下滚动,自动即使web视图页面已达到了它的终点。我想确保每个页面滚动,直到web视图的结尾。

  webview.loadUrl(文件:/// android_asset /+位置+名.html);
            。webview.getSettings()setBuiltInZoomControls(真正的);
            webview.setPictureListener(新PictureListener(){

                公共无效onNewPicture(web视图来看,画中画){
                    INT WEBBOT = webview.getBottom();

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

解决方案

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

  wv.setWebViewClient(新WebViewClient(){
        @覆盖
        公共无效onPageFinished(web视图查看,字符串URL){
             // TODO自动生成方法存根
            super.onPageFinished(查看,网址);
            Log.i(TAG,onPageFinished援引!);
            wv.scrollBy(0,wv.getBottom());
            }

    });
 

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

解决方案

Try this, (Basically using onPageFinished() instead of 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());
            }

    }); 

这篇关于当停止web视图是在最后的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆