xamarin.android.StickyHeader 1.1.0

dotnet add package xamarin.android.StickyHeader --version 1.1.0                
NuGet\Install-Package xamarin.android.StickyHeader -Version 1.1.0                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="xamarin.android.StickyHeader" Version="1.1.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add xamarin.android.StickyHeader --version 1.1.0                
#r "nuget: xamarin.android.StickyHeader, 1.1.0"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install xamarin.android.StickyHeader as a Cake Addin
#addin nuget:?package=xamarin.android.StickyHeader&version=1.1.0

// Install xamarin.android.StickyHeader as a Cake Tool
#tool nuget:?package=xamarin.android.StickyHeader&version=1.1.0                

A very simple library that allows you to stick any View as a header of a:

  • ListView
  • RecyclerView
  • ScrollView

Adding a Sticky Header

To stick a header to a list view, we just need a ListView and any View to use as the header:

<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_height="match_parent" />
            android:text="Hello World!"
            android:textSize="25dp" />

Once we have the layout inflated, we can use the StickyHeaderBuilder to attach the header to the list:

var listView = container.FindViewById<ListView>(Resource.Id.listview);
    .SetHeader(Resource.Id.header, container)

Using a Sticky Header Animator

There are various animations that can be used when transitioning the header. This is easily done with the AnimatorBuilder type. Some of the built in transitions are:

  • Scale
  • Translation
  • Fade
  • Parallax

For simple transitions, we can pass a delegate that returns an AnimatorBuilder to the SetAnimator method:

.SetAnimator(() => {
    var image = View.FindViewById(Resource.Id.header_image);
    return AnimatorBuilder

If we need more complex transitions, we can inherit from HeaderStickyAnimator:

public class IconActionBarAnimator : HeaderStickyAnimator
	private readonly View homeActionBar;
	private readonly int layoutResource;

	public IconActionBarAnimator(Activity activity, int layoutResource)
		this.layoutResource = layoutResource;
		this.homeActionBar = activity.FindViewById(Android.Resource.Id.Home);

	public override AnimatorBuilder CreateAnimatorBuilder()
		var view = Header.FindViewById(layoutResource);
		var rect = new RectangleF(
			homeActionBar.Left, homeActionBar.Top,
			homeActionBar.Right, homeActionBar.Bottom);
		var point = new PointF(homeActionBar.Left, homeActionBar.Top);
		return AnimatorBuilder
			.ApplyScale(view, rect)
			.ApplyTranslation(view, point);
Product Compatible and additional computed target framework versions.
MonoAndroid monoandroid403 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.1.0 1,137 2/26/2018