Custom behavior public class InfoPaneFabBehavior : CoordinatorLayout.Behavior { // …
public override bool LayoutDependsOn (CoordinatorLayout parent, Java.Lang.Object child, View dependency) { return dependency is InfoPane; }
public override bool OnDependentViewChanged (CoordinatorLayout parent, Java.Lang.Object child, View dependency) { // Move the fab vertically to place correctly wrt the info pane var fab = child.JavaCast (); var currentInfoPaneY = ViewCompat.GetTranslationY (dependency); var newTransY = (int)Math.Max (0, dependency.Height - currentInfoPaneY - minMarginBottom - fab.Height / 2); ViewCompat.SetTranslationY (fab, -newTransY);
// If alternating between open/closed state, change the FAB face if (wasOpened ^ ((InfoPane)dependency).Opened) { fab.Switch (); wasOpened = !wasOpened; }