注意:
1.AppBarLayout与NestedScrollView的位置关系
2.toolbar设置layout_scrollFlags
3.NestedScrollView设置layout_behavior
4.CoordinatorLayout即最外层父布局设置background是因为配合滑动返回的windowbackground设置了透明
更新说明:
修改progressbar层级关系,滑动后还是会隐藏,下次再修改看看效果
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white">
<android.support.v4.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
android:fitsSystemWindows="true">
<WebView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/mainWebView3"
android:focusable="true"
android:focusableInTouchMode="true"/>
</android.support.v4.widget.NestedScrollView>
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="46dp"
android:fitsSystemWindows="true"
android:background="@color/white">
<ProgressBar
style="?android:attr/progressBarStyleHorizontal"
android:id="@+id/myProgressBar3"
android:layout_width="match_parent"
android:layout_height="2dip"
android:progressDrawable="@drawable/layer"
app:layout_scrollFlags="scroll|enterAlways"
/>
<android.support.v7.widget.Toolbar
android:id="@+id/web3_toolbar"
android:layout_width="match_parent"
android:layout_height="44dp"
android:background="#00000000"
app:layout_scrollFlags="scroll|enterAlways"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
app:theme="@style/ThemeOverlay.AppCompat.ActionBar" />
</android.support.design.widget.AppBarLayout>
</android.support.design.widget.CoordinatorLayout>