简体   繁体   中英

How to end scrolling of Webview 300 dps from end of Webview (or end of web page)? (Android Java)

I am unable to edit some footers on my web page and therefore would like to hide the web page footer by not allowing the user to scroll there. I have the following Webview;

            myWebView.loadUrl(value);
            myWebView.setWebChromeClient(new MyWebChromeClient() {
                public void onProgressChanged(WebView view, int progress1) {
                    MyActivity.setProgress(progress1 * 100);
                }
            });

            myWebView.setWebViewClient(new MyWebViewClient() {
                public void onLoadResource(WebView view, String url) {
                    super.onLoadResource(view, url);
                }
            });
             myWebView.setOnTouchListener(new View.OnTouchListener() {
                @Override
                public boolean onTouch(View v, MotionEvent event) {
                    switch (event.getAction()) {
                        case MotionEvent.ACTION_DOWN:
                            //Doing stuff here
                            break;
                        case MotionEvent.ACTION_UP:
                            //Doing stuff here
                            break;
                    }
                    return false;
                }
            });

However, I am unable to figure out how to disable scrolling when the user reaches the final 300 dps or so of his screen size. I would also like some clarification on whether using both the setWebChromeClient and setWebViewClient like mentioned above is okay. If yes, which client would the Android device pick?

I fixed this issue by storing the web page HTML contents to a string and then parsing and displaying it using;

myWebView.loadDataWithBaseURL(null, str, "text/html", "UTF-8", null);

Hope this helps someone.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM