[英]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;
我有以下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. 但是,我无法弄清楚当用户达到屏幕大小的最后300 dps时如何禁用滚动。 I would also like some clarification on whether using both the
setWebChromeClient
and setWebViewClient
like mentioned above is okay. 我还想澄清一下是否同时使用上述
setWebChromeClient
和setWebViewClient
是否可以。 If yes, which client would the Android device pick? 如果是,Android设备将选择哪个客户端?
I fixed this issue by storing the web page HTML contents to a string and then parsing and displaying it using; 我通过将网页HTML内容存储到字符串中,然后使用进行解析和显示来解决此问题。
myWebView.loadDataWithBaseURL(null, str, "text/html", "UTF-8", null); myWebView.loadDataWithBaseURL(null,str,“ text / html”,“ UTF-8”,null);
Hope this helps someone. 希望这对某人有帮助。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.