0

I am using coordinator layout with a custom collapsing view and tablayout. Here is the xml

<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:fresco="http://schemas.android.com/apk/res-auto"
android:id="@+id/main_content"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true">

<android.support.design.widget.AppBarLayout
    android:id="@+id/appbar"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:theme="@style/ThemeOverlay.AppCompat.Light">

    <android.support.design.widget.CollapsingToolbarLayout
        android:id="@+id/collapsing_toolbar"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:fitsSystemWindows="true"
        app:contentScrim="?attr/colorPrimary"
        app:layout_scrollFlags="scroll|exitUntilCollapsed">

        <RelativeLayout
            android:id="@+id/cardParentLayout"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            app:layout_collapseMode="parallax">

            <com.facebook.drawee.view.SimpleDraweeView
                android:id="@+id/profilePicOverlay"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                fresco:actualImageScaleType="centerCrop"
                fresco:overlayImage="@drawable/profile_overlay" />

            <RelativeLayout
                android:id="@+id/childParentToAnimate"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:visibility="invisible">

                <include
                    android:id="@+id/cardLayout"
                    layout="@layout/layout_profile_card"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_centerInParent="true" />

                <com.facebook.drawee.view.SimpleDraweeView
                    android:id="@+id/profilePicCard"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_centerHorizontal="true"
                    fresco:actualImageScaleType="centerCrop"
                    fresco:backgroundImage="@drawable/profile_placeholder"
                    fresco:roundAsCircle="true"
                    fresco:roundingBorderColor="@color/white"
                    fresco:roundingBorderWidth="2dp" />

            </RelativeLayout>

        </RelativeLayout>

        <android.support.v7.widget.Toolbar
            android:id="@+id/toolbar"
            android:layout_width="match_parent"
            android:layout_height="51dp"
            app:layout_collapseMode="pin"
            app:popupTheme="@style/AppTheme" />

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

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

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_gravity="fill_vertical"
    android:fillViewport="true"
    android:orientation="vertical"
    app:layout_behavior="@string/appbar_scrolling_view_behavior">

    <android.support.design.widget.TabLayout
        android:id="@+id/tabs"
        android:layout_width="match_parent"
        android:layout_height="?attr/actionBarSize"
        android:layout_gravity="bottom"
        android:background="@color/blue_primary"
        app:tabGravity="fill"
        app:tabIndicatorColor="@android:color/white"
        app:tabMode="fixed" />

    <android.support.v4.view.ViewPager
        android:id="@+id/viewpager"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />

</LinearLayout>

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

The problem is that when collapsed, the toolbar is appearing white (default gray color) as you can see in this image.

enter image description here

If I add background attribute to toolbar in xml, the toolbar is appearing even when not collapsed

Carl Anderson
  • 3,446
  • 1
  • 25
  • 45
Hirak Chhatbar
  • 3,159
  • 1
  • 27
  • 36
  • [try this](http://stackoverflow.com/questions/2591036/how-to-hide-the-title-bar-for-an-activity-in-xml-with-existing-custom-theme) To hide the toolbar. Do it pragmatically in activity onCareate() method. Link is to another stackoverflow question. – abcdef12 Jan 24 '16 at 15:23
  • app:layout_scrollFlags="scroll|enterAlways" add this line to your toolbar and remove pinnig – Surender Kumar Jan 24 '16 at 16:18

0 Answers0