Dha*_*oni 6 mobile android webview openerp swiperefreshlayout
我正在尝试使用Android WebView开发混合应用程序,在移动webview上加载网站.
在FrameLayout中添加WebView对象运行时.
<android.support.v4.widget.SwipeRefreshLayout
android:id="@+id/swipeToRefresh"
android:layout_width="match_parent"
android:layout_height="match_parent">
<FrameLayout
android:id="@+id/webViewContainer"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</android.support.v4.widget.SwipeRefreshLayout>
Run Code Online (Sandbox Code Playgroud)
对于SwipeRefreshLayout启用/禁用时,页面顶部,增加TreeObserver了滚动检测WebView
odooWebView.getViewTreeObserver().addOnScrollChangedListener(new ViewTreeObserver.OnScrollChangedListener() {
@Override
public void onScrollChanged() {
swipeRefreshLayout.setEnabled(odooWebView.getScrollY() == 0);
}
});
Run Code Online (Sandbox Code Playgroud)
它适用于所有具有可滚动内容的页面.但内部垂直滚动的页面卡住了刷卡刷新
与应用和Chrome浏览器的视频比较:
应用:https ://drive.google.com/file/d/0B7bMj_vvgmpveEV2MkNYc0xOY3c/view?usp= sharing Chrome应用:https://drive.google.com/file/d/0B7bMj_vvgmpvUktYQVpONXl1ekk/view? usp =sharing
| 归档时间: |
|
| 查看次数: |
463 次 |
| 最近记录: |