githubwing / ByeBurger

An Android behavior library let your titlebar or bottom navigation hiding on scroll ,极其简便的快速实现滑动隐藏标题栏和导航栏

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

toolbar会遮挡住部分recyclerView

LinHuanTanLy opened this issue · comments

<android.support.design.widget.CoordinatorLayout>

<--! 这里放你的布局内容,可以是任意view-->



</android.support.design.widget.CoordinatorLayout>

这个样子的话,toolbar不会遮挡住recyclerView吗

可以使用appbarlayout

`
<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"