【发布时间】:2016-08-30 15:32:54
【问题描述】:
使用所有最新的库。我在 CoordinatorLayout 片段中有一个简单的 WebView。试图在用户滚动 sdown 时隐藏工具栏。
<android.support.design.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/clRootHome"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:context="com.bytefury.deliverzz.fragment.HomeFragment">
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_scrollFlags="scroll|enterAlways"
android:theme="@style/AppTheme.AppBarOverlay">
<include layout="@layout/toolbar" />
</android.support.design.widget.AppBarLayout>
<android.support.v4.widget.SwipeRefreshLayout
android:id="@+id/srlHome"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<android.support.v4.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<im.delight.android.webview.AdvancedWebView
android:id="@+id/frag_wv_wv"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scrollbarStyle="insideOverlay" />
</android.support.v4.widget.NestedScrollView>
</android.support.v4.widget.SwipeRefreshLayout>
</android.support.design.widget.CoordinatorLayout>
但是,这根本没有任何作用。滑动刷新效果很好。
无奈之下,当我切换 NestedScrollView 和 SwipeRefreshLayout 时,我得到一个空白的白色屏幕。
【问题讨论】:
-
我认为你不需要
NestedScrollView。 webview 应该可以很好地处理滚动。 -
我可能不清楚。使用了 NestedScrollView,因此当 webView 滚动时工具栏将隐藏。
-
您可以在没有
NestedScrollView的情况下实现这一目标。我会发布一个答案。