Open LinHuanTanLy opened 6 years ago
可以使用appbarlayout
`<?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:id="@+id/activity_main" android:layout_width="match_parent" android:layout_height="match_parent" android:fitsSystemWindows="true" android:orientation="vertical">
<android.support.design.widget.AppBarLayout
android:id="@+id/app_bar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<android.support.v7.widget.Toolbar
android:id="@+id/tlMainToolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="@color/colorPrimary"
app:layout_behavior="@string/bye_burger_title_behavior"
app:layout_scrollFlags="scroll|enterAlways"/>
</android.support.design.widget.AppBarLayout>
<catplay.kotlin.widget.NoScrollViewPager
android:id="@+id/vpMainContent"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior"/>
<android.support.design.widget.BottomNavigationView
android:id="@+id/byeMainMenu"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:background="@color/colorPrimary"
app:itemIconTint="@color/main_white_color"
app:itemTextColor="@color/main_white_color"
app:layout_behavior="@string/bye_burger_bottom_behavior"
app:menu="@menu/bottom"/>
<android.support.design.widget.FloatingActionButton
android:id="@+id/fBtnMainBall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|right"
android:layout_marginBottom="60dp"
android:layout_marginEnd="@dimen/margin_10"
android:layout_marginRight="@dimen/margin_10"
app:backgroundTint="@color/colorPrimary"
app:layout_behavior="@string/bye_burger_float_behavior"/>
</android.support.design.widget.CoordinatorLayout> `
在NoScrollViewPager中加入:app:layout_behavior="@string/appbar_scrolling_view_behavior"