2
You can add the contentScrim
at the CollapsingToolbarLayout
and make the bottom of the toolbar transparent, but with opacity, or if you prefer with a solid color. Since you didn’t put any code, it would be something in this format:
<android.support.design.widget.CollapsingToolbarLayout
android:id="@+id/collapse_toolbar"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_scrollFlags="scroll|exitUntilCollapsed"
android:fitsSystemWindows="true"
app:contentScrim="?attr/colorPrimary"
app:expandedTitleMarginStart="48dp"
app:expandedTitleMarginEnd="64dp">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/image"
android:fitsSystemWindows="true"
app:layout_collapseMode="parallax"
android:scaleType="centerCrop"/>
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
app:layout_collapseMode="pin"/>
</android.support.design.widget.CollapsingToolbarLayout>
A GIF is worth a thousand images
As shown in the image above, the color of Toolbar
is solid. To be transparent, simply change the value of contentScreem
for a color that has opacity. For example app:contentScrim="#77000000"
. See the image below:
Ask the question what xml you are using .
– ramaral
Can you show us how you did it? Help people help you! =)
– Thiago Luiz Domacoski