Skip to content

Commit 6a47023

Browse files
committed
修改bug
1 parent a559cd5 commit 6a47023

File tree

3 files changed

+10
-3
lines changed

3 files changed

+10
-3
lines changed

.idea/misc.xml

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/src/main/java/com/example/administrator/webviewlist/MainActivity.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,9 @@ public void onScrollBottom() {
4040
button.setOnClickListener(new View.OnClickListener() {
4141
@Override
4242
public void onClick(View view) {
43-
if (scrollWebView.isShown()) {
43+
recyclerView.scrollToPosition(0);
4444
scrollWebView.scrollTo(0, 0);
45-
}
45+
4646

4747
// recyclerView.smoothScrollToPosition(20);
4848
}

webviewscroll/src/main/java/com/example/webviewscroll/WebScrollLayout.java

+7
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
7676
mDispatchWebView.setOnCustomScroolChangeListener(new ScrollWebView.ScrollInterface() {
7777
@Override
7878
public void onSChanged(int l, int t, int oldl, int oldt) {
79+
Log.d("调用滑动事件",l+" "+t+" "+oldl+" "+oldt);
7980
float webViewContentHeight = mDispatchWebView.getContentHeight() * mDispatchWebView.getScale();
8081
Log.d("内容高度",webViewContentHeight+"");
8182
float webViewCurrentHeight = (mDispatchWebView.getHeight() + mDispatchWebView.getScrollY());
@@ -87,6 +88,12 @@ public void onSChanged(int l, int t, int oldl, int oldt) {
8788
isIntercept = false;
8889
}
8990

91+
}else {
92+
System.out.println("WebView滑动到了不是底端");
93+
if (isScrollUp && mDispatchWebView.isScroll()) {
94+
mDispatchWebView.ignoreTouchCancel(true);
95+
isIntercept = true;
96+
}
9097
}
9198
}
9299
});

0 commit comments

Comments
 (0)