Wie man einen Farbverlauf zu einer in einer CollapsingToolbar verschachtelten ImageView hinzufügt
Ich arbeite an einer Android-App mit Materialdesign. Ich habe eine Detailansicht mit einem CollapsingToolbarLayout und einer ImageView (funktioniert soweit einwandfrei). Leider ist der Titel bei hellem Bild nicht lesbar.isher habe ich versucht, einen Farbverlauf hinzuzufügen Farbverlauf zur Bildansicht hinzufügen) aber diese Lösung hat bei mir wegen des CollapsingToolbarLayout nicht funktioniert. Hier können Sie meinen Code sehen:
<android.support.design.widget.CoordinatorLayout
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="match_parent"
android:fitsSystemWindows="true">
<android.support.design.widget.AppBarLayout
android:layout_height="256dp"
android:layout_width="match_parent"
android:fitsSystemWindows="true"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">
<android.support.design.widget.CollapsingToolbarLayout
android:id="@+id/collapsing_toolbar"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_scrollFlags="scroll|exitUntilCollapsed"
app:contentScrim="@color/primary"
android:fitsSystemWindows="true"
app:expandedTitleMarginEnd="50dp"
app:expandedTitleMarginStart="50dp"
>
<!--<View
android:background="@drawable/actionbar_gradient_dark"
/>-->
<ImageView
android:id="@+id/backimg"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
app:layout_collapseMode="parallax"
android:scaleType="centerCrop"
app:layout_scrollFlags="scroll|enterAlways"
/>
<android.support.v7.widget.Toolbar
android:id="@+id/detailToolbar"
android:layout_height="?attr/actionBarSize"
android:layout_width="match_parent"
app:layout_collapseMode="pin"
app:layout_collapseParallaxMultiplier="0.7"
app:layout_scrollFlags="scroll|enterAlways"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light"/>
</android.support.design.widget.CollapsingToolbarLayout>
Kennt jemand eine Lösung für dieses Problem?