#. Here I used CollapsingToolbarLayout height as 300dp , which is the sum of Toolbar , ImageSlider and TabLayout height. Used app:titleEnabled="false" to hide the CollapsingToolbar title .
#. Inside CollapsingToolbarLayout , RelativeLayout added as a container for ViewPager (images) and LinearLayout (indicator). Added the android:layout_marginTop="?attr/actionBarSize" attribute android:layout_marginTop="?attr/actionBarSize" to place it below the Toolbar and added the app:layout_collapseMode="parallax" to show the parallax effect while scrolling.
#. An ImageView added below the RelativeLayout to show a GIF image on it. Attribute android:layout_height="?attr/actionBarSize" to make its height as Toolbar height. Added app:layout_collapseMode="pin" attribute app:layout_collapseMode="pin" to keep ImageView fixed at top and visible before or after scrolling.
# Added Toolbar below ImageView to show Toolbar over ImageView . Since I did not set the background color to Toolbar , it will work as transparent . Like ImageView , added app:layout_collapseMode="pin" in the Toolbar until pin always at the top . Added the android:layout_height="104dp" attribute android:layout_height="104dp" to show the TabLayout below the Toolbar during the collapsed state. Here 104dp is Toolbar height ( 56dp ) + TabLayout height ( 48dp ).
#. Finally, a TabLayout added below the Toolbar and an android:layout_gravity="bottom" attribute is added android:layout_gravity="bottom" to show it at the bottom of the CollapsingToolbarLayout .
Here is a simplified working XML:
<?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/coordinator_layout" 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:fitsSystemWindows="true" android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"> <android.support.design.widget.CollapsingToolbarLayout android:id="@+id/htab_collapse_toolbar" android:layout_width="match_parent" android:layout_height="300dp" android:fitsSystemWindows="true" app:titleEnabled="false" app:layout_scrollFlags="scroll|exitUntilCollapsed|snap"> <RelativeLayout android:id="@+id/image_layer" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_marginTop="?attr/actionBarSize" app:layout_collapseMode="parallax"> <android.support.v4.view.ViewPager android:id="@+id/image_gallery" android:layout_width="match_parent" android:layout_height="match_parent"/> <LinearLayout android:id="@+id/image_indicators" android:layout_width="100dp" android:layout_height="wrap_content" android:layout_alignParentBottom="true" android:layout_centerHorizontal="true" android:layout_marginBottom="56dp" android:orientation="horizontal" android:padding="8dp" android:gravity="center" android:background="@color/black"/> </RelativeLayout> <ImageView android:id="@+id/toolbar_background" android:layout_width="match_parent" android:layout_height="?attr/actionBarSize" android:scaleType="centerCrop" app:layout_collapseMode="pin" android:src="@drawable/dummy"/> <android.support.v7.widget.Toolbar android:id="@+id/toolbar" android:layout_width="match_parent" android:layout_height="104dp" android:minHeight="?attr/actionBarSize" app:layout_collapseMode="pin"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:textAllCaps="true" android:textColor="#000" android:textStyle="bold" android:gravity="center" android:maxLines="1" android:ellipsize="end" android:layout_gravity="top" android:id="@+id/toolbar_title" android:text="Restaurant Title"/> </android.support.v7.widget.Toolbar> <android.support.design.widget.TabLayout android:id="@+id/tab_layout" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_gravity="bottom" app:tabBackground="@android:color/holo_red_dark" app:tabIndicatorColor="@android:color/transparent" app:tabGravity="fill" app:tabMode="fixed" app:tabMaxWidth="2000dp"/> </android.support.design.widget.CollapsingToolbarLayout> </android.support.design.widget.AppBarLayout> <android.support.v4.view.ViewPager android:id="@+id/container" android:layout_width="match_parent" android:layout_height="match_parent" app:layout_behavior="@string/appbar_scrolling_view_behavior"/> </android.support.design.widget.CoordinatorLayout>
OUTPUT:

FYI, since you are using a custom Toolbar with a TextView , you need to hide the default value of the title ActionBar . To do this, use the following codes in Activity :
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); getSupportActionBar().setTitle("");
Hope this helps ~
source share