0

Good evening folks,

Here's the deal. I put some widgets inside my CollapsingToolbarLayout (2 TextViews, 2 ImageViews, 1 ImageButton and 1 NetworkImageView that appears in the background) alongside a Toolbar. The result is great on Lollipop.

Here's what it looks like on Lollipop (desired result): enter image description here

However, from Android 4.0 to Android 4.4, this is the result: enter image description here

The children views don't appear. As you can see, all these views are supposed to be at the bottom of the layout.. and I've actually noticed they do appear but only when the bottom of the expanded App bar is aligned underneath the toolbar. This is why 1 of the two ImageViews does appear.

.. Very weird.

Anyway, here's my full AppBarLayout, which is later included in another layout.

<android.support.design.widget.AppBarLayout
android:id="@+id/appbar"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="192dp"
android:fitsSystemWindows="true"
android:theme="@style/actionBar.QuickLyric"
app:layout_behavior="com.geecko.QuickLyric.utils.AppBarBehavior">

<android.support.design.widget.CollapsingToolbarLayout
    android:id="@+id/toolbar_layout"
    android:layout_width="match_parent"
    android:layout_height="192dp"
    android:fitsSystemWindows="true"
    app:contentScrim="?attr/colorPrimary"
    app:expandedTitleMarginBottom="162dp"
    app:expandedTitleMarginStart="60dp"
    app:expandedTitleTextAppearance="@style/TextAppearance.Invisible"
    app:layout_scrollFlags="scroll|exitUntilCollapsed">

    <com.geecko.QuickLyric.view.FadeInNetworkImageView
        android:id="@+id/cover"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:contentDescription="@string/cover_art_desc"
        android:scaleType="centerCrop"
        android:background="@color/cover_bg"
        app:layout_collapseMode="parallax"
        app:layout_collapseParallaxMultiplier="0.5"/>

    <ImageView
        android:layout_width="match_parent"
        android:layout_height="?actionBarSize"
        android:layout_gravity="top"
        android:rotation="180"
        android:src="@drawable/gradient_overlay"
        app:layout_collapseMode="pin"/>

    <ImageView
        android:layout_width="match_parent"
        android:layout_height="?actionBarSize"
        android:layout_gravity="bottom"
        android:src="@drawable/gradient_overlay"/>

    <TextView
        android:id="@+id/song"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="bottom|start"
        android:layout_marginBottom="25dp"
        android:ellipsize="end"
        android:paddingLeft="12dp"
        android:paddingRight="26dp"
        android:scrollHorizontally="true"
        android:singleLine="true"
        android:textAppearance="@style/TextAppearance.AppCompat.Title"
        android:textColor="?android:textColorPrimary"/>

    <TextView
        android:id="@+id/artist"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="start|bottom"
        android:layout_marginBottom="5dp"
        android:ellipsize="end"
        android:paddingLeft="12dp"
        android:paddingRight="26dp"
        android:scrollHorizontally="true"
        android:singleLine="true"
        android:textAppearance="@style/TextAppearance.AppCompat.Subhead"
        android:textColor="?android:textColorSecondary"/>

    <ImageButton
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="end|bottom"
        android:layout_margin="4dp"
        android:background="?android:attr/selectableItemBackground"
        android:padding="10dp"
        android:src="@drawable/ic_edit"/>

    <android.support.v7.widget.Toolbar
        android:id="@+id/toolbar"
        android:layout_width="match_parent"
        android:layout_height="?attr/actionBarSize"
        android:elevation="4dp"
        android:focusable="false"
        app:layout_collapseMode="pin"
        app:popupTheme="@style/ThemeOverlay.AppCompat.Light"/>
</android.support.design.widget.CollapsingToolbarLayout>

Hopefully you guys can help.. :/

geecko
  • 660
  • 1
  • 9
  • 22
  • Seems to be an issue with `app:contentScrim`. Removing the content scrim fixes the child views from disappearing. Clearly not ideal but worth noting until this is fixed. – Sean Croft Apr 08 '16 at 22:12
  • The bug in new version of support-design libray has been fixed. com.android.support:design:23.2.1 – gaoyan Apr 25 '16 at 08:05

1 Answers1

0

It's been filed as a bug and will be fixed in a future Release.

Source: https://code.google.com/p/android/issues/detail?id=177738&can=1&q=CollapsingToolbarLayout&colspec=ID%20Type%20Status%20Owner%20Summary%20Stars

geecko
  • 660
  • 1
  • 9
  • 22