注意:
1.AppBarLayout與NestedScrollView的位置關(guān)系
2.toolbar設(shè)置layout_scrollFlags
3.NestedScrollView設(shè)置layout_behavior
4.CoordinatorLayout即最外層父布局設(shè)置background是因為配合滑動返回的windowbackground設(shè)置了透明
更新說明:
修改progressbar層級關(guān)系,滑動后還是會隱藏,下次再修改看看效果
<?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>