diff --git a/.idea/misc.xml b/.idea/misc.xml index cca2cda..7158618 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -37,7 +37,7 @@ - + diff --git a/app/src/main/java/com/example/administrator/webviewlist/MainActivity.java b/app/src/main/java/com/example/administrator/webviewlist/MainActivity.java index 1523026..6e6f1fa 100644 --- a/app/src/main/java/com/example/administrator/webviewlist/MainActivity.java +++ b/app/src/main/java/com/example/administrator/webviewlist/MainActivity.java @@ -40,9 +40,9 @@ public void onScrollBottom() { button.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { - if (scrollWebView.isShown()) { + recyclerView.scrollToPosition(0); scrollWebView.scrollTo(0, 0); - } + // recyclerView.smoothScrollToPosition(20); } diff --git a/webviewscroll/src/main/java/com/example/webviewscroll/WebScrollLayout.java b/webviewscroll/src/main/java/com/example/webviewscroll/WebScrollLayout.java index 753b74f..bbea456 100644 --- a/webviewscroll/src/main/java/com/example/webviewscroll/WebScrollLayout.java +++ b/webviewscroll/src/main/java/com/example/webviewscroll/WebScrollLayout.java @@ -76,6 +76,7 @@ public void onScrolled(RecyclerView recyclerView, int dx, int dy) { mDispatchWebView.setOnCustomScroolChangeListener(new ScrollWebView.ScrollInterface() { @Override public void onSChanged(int l, int t, int oldl, int oldt) { + Log.d("调用滑动事件",l+" "+t+" "+oldl+" "+oldt); float webViewContentHeight = mDispatchWebView.getContentHeight() * mDispatchWebView.getScale(); Log.d("内容高度",webViewContentHeight+""); float webViewCurrentHeight = (mDispatchWebView.getHeight() + mDispatchWebView.getScrollY()); @@ -87,6 +88,12 @@ public void onSChanged(int l, int t, int oldl, int oldt) { isIntercept = false; } + }else { + System.out.println("WebView滑动到了不是底端"); + if (isScrollUp && mDispatchWebView.isScroll()) { + mDispatchWebView.ignoreTouchCancel(true); + isIntercept = true; + } } } });