I'm trying to make an Android activity that bleeds into the notification area as shown below. I have a solution, but I don't like it because it's pure magic -- I have no idea why it works, it just does. In the code sample below, I have a CoordinatorLayout
holding an AppBarLayout
holding a CollapsingToolbarLayout
. If any of this is removed or changed in any way, the effect no longer works. The LinearLayout
at the bottom contains the actual code layout info I want to use.
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
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="match_parent"
android:fitsSystemWindows="true"
>
<android.support.design.widget.CollapsingToolbarLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
/>
</android.support.design.widget.AppBarLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
>
<ImageView
android:id="@+id/backdrop"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerCrop"
/>
</LinearLayout>
</android.support.design.widget.CoordinatorLayout>