Nominalista
Nominalista

Reputation: 4840

Two toolbars in CoordinatorLayout

Is it possible to have two toolbars in CoordinatorLayout, one at the bottom one on the top and both are reacting on scrolling ?

Unfortunately this is not working:

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

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

        <android.support.v4.widget.SwipeRefreshLayout
            android:id="@+id/layout_swipe_refresh"
            android:layout_width="match_parent"
            android:layout_height="match_parent">

            <android.support.v7.widget.RecyclerView
                android:id="@+id/recycler_view"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:background="?attr/background"/>

        </android.support.v4.widget.SwipeRefreshLayout>

        <android.support.v7.widget.Toolbar
            android:id="@+id/toolbar_bottom"
            android:layout_width="match_parent"
            android:layout_height="?attr/actionBarSize"
            android:layout_gravity="bottom"
            app:layout_scrollFlags="scroll|enterAlways"/>

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

Upvotes: 1

Views: 708

Answers (1)

e-shfiyut
e-shfiyut

Reputation: 3675

You can create your own CoordinatorLayout custom behavior, maybe similar FooterBar from coordinated-effort project as an example.

The layout.xml is similar to what you suggested, but uses AppBarLayout once, and the FooterBarLayout on the bottom.

Upvotes: 1

Related Questions