上滑 顯示底部 下滑 隱藏頂部 協調者佈局

丿灬安之若死發表於2017-10-26
<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.DrawerLayout
    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/drawer_layout"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:fitsSystemWindows="true"
    android:background="@color/main_activity_color"
    tools:openDrawer="start">

    <android.support.design.widget.CoordinatorLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:fitsSystemWindows="true"
        >

        <android.support.design.widget.AppBarLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:theme="@style/AppLockAppBarOverlay">

            <android.support.v7.widget.Toolbar
                android:id="@+id/toolbar"
                android:layout_width="match_parent"
                android:layout_height="?attr/actionBarSize"
                android:background="@drawable/actionbar_background"
                app:layout_scrollFlags="scroll|enterAlways"
                app:popupTheme="@style/AppLockPopupOverlay"/>

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

        <RelativeLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            app:layout_behavior="@string/appbar_scrolling_view_behavior">

            <android.support.v7.widget.RecyclerView
                android:id="@+id/app_list"
                android:layout_above="@+id/adView"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:scrollbars="vertical">

            </android.support.v7.widget.RecyclerView>
            <FrameLayout
                android:id="@+id/adView"
                android:layout_alignParentBottom="true"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"></FrameLayout>
        </RelativeLayout>


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




主要是

  app:layout_behavior="@string/appbar_scrolling_view_behavior"
    <string name="appbar_scrolling_view_behavior" translatable="false">android.support.design.widget.AppBarLayout$ScrollingViewBehavior</string>
下面的應該是沒有用到

   <style name="AppLockAppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" />
    <style name="AppLockPopupOverlay" parent="ThemeOverlay.AppCompat.Light" />
app樣式是

繼承這個 

Theme.AppCompat.Light.DarkActionBar
        <item name="windowActionBar">false</item>
        <item name="windowNoTitle">true</item>




相關文章