滑动刷新覆盖了在 webview 中滚动我的网页中的菜单
swipe refresh is overriding scrolling the menu in my web page in webview
我正在 Web 视图中设置网页。我的网页向下滑动刷新 function.when 我的网页在顶部,当我在我的网页中滚动抽屉菜单时,滑动刷新正在发生。如何解决这个问题?
main activity布局代码
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginBottom="45dp"
android:orientation="vertical">
<ProgressBar
android:layout_width="match_parent"
android:layout_height="10dp"
android:id="@+id/progressBar"
style="@style/Widget.AppCompat.ProgressBar.Horizontal"/>
<android.support.v4.widget.SwipeRefreshLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/swipe">
<WebView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/homeWeb"
android:layout_above="@id/navBar"/>
</android.support.v4.widget.SwipeRefreshLayout>
</LinearLayout>
MainActivity
swipe.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener(){
@Override
public void onRefresh() {
homeWeb.reload();
}
});
Enable/Disable 使用 webview 时滑动刷新。
下面的方法做同样的事情。尝试让我知道它是否有效。
swipe.getViewTreeObserver().addOnScrollChangedListener(new ViewTreeObserver.OnScrollChangedListener() {
@Override
public void onScrollChanged() {
swipe.setEnabled((homeWeb.getScrollY() == 0));
}
});
我正在 Web 视图中设置网页。我的网页向下滑动刷新 function.when 我的网页在顶部,当我在我的网页中滚动抽屉菜单时,滑动刷新正在发生。如何解决这个问题?
main activity布局代码
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginBottom="45dp"
android:orientation="vertical">
<ProgressBar
android:layout_width="match_parent"
android:layout_height="10dp"
android:id="@+id/progressBar"
style="@style/Widget.AppCompat.ProgressBar.Horizontal"/>
<android.support.v4.widget.SwipeRefreshLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/swipe">
<WebView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/homeWeb"
android:layout_above="@id/navBar"/>
</android.support.v4.widget.SwipeRefreshLayout>
</LinearLayout>
MainActivity
swipe.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener(){
@Override
public void onRefresh() {
homeWeb.reload();
}
});
Enable/Disable 使用 webview 时滑动刷新。 下面的方法做同样的事情。尝试让我知道它是否有效。
swipe.getViewTreeObserver().addOnScrollChangedListener(new ViewTreeObserver.OnScrollChangedListener() {
@Override
public void onScrollChanged() {
swipe.setEnabled((homeWeb.getScrollY() == 0));
}
});