Xamarin Forms Android Toolbar to Expand/Collapse When Scrolling

Viewed 887

I'm attempting to implement something similar to what you see in the Android Google Contacts app. You have a large toolbar with content underneath and when you scroll to view the content, the toolbar shrinks and the content in the toolbar shifts, fades and shrinks to fit into a standard size toolbar.

I'm using Xamarin Forms and Visual Studio 2017. My MainActivity.cs is inheriting FormsAppCompatActivity and I've implemented a standard Resource.Layout.Toolbar.

ToolbarResource = Resource.Layout.Toolbar;

The toolbar is styled so the background is transparent however.

<android.support.v7.widget.Toolbar
  xmlns:android="http://schemas.android.com/apk/res/android"
  android:id="@+id/toolbar"
  android:layout_width="match_parent"
  android:layout_height="wrap_content"
  android:background="@color/transparent"
  android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
  android:popupTheme="@style/ThemeOverlay.AppCompat.Light"/>

I cannot figure out how to get the ScrollView (or any other element) to sit underneath the toolbar. I have seen a few other posts relating to this but nothing using Xamarin Forms.

Is this possible to sit content underneath the toolbar? If so, how do I do it?

1 Answers
Related