Snackbar not pushing FAB up RRS feed

  • Question

  • User14506 posted

    My RecyclerView hides my FAB on scroll with the following behavior.

        public class ScrollAwareFABBehavior : CoordinatorLayout.Behavior
            public ScrollAwareFABBehavior(Context context, IAttributeSet attrs) : base(context, attrs)
            public override bool OnStartNestedScroll(CoordinatorLayout coordinatorLayout, Java.Lang.Object child, View directTargetChild, View target, int nestedScrollAxes)
                return nestedScrollAxes == ViewCompat.ScrollAxisVertical ||
                         base.OnStartNestedScroll(coordinatorLayout, child, directTargetChild, target, nestedScrollAxes);
            public override void OnNestedScroll(CoordinatorLayout coordinatorLayout, Java.Lang.Object child, View target, int dxConsumed, int dyConsumed, int dxUnconsumed, int dyUnconsumed)
                base.OnNestedScroll(coordinatorLayout, child, target, dxConsumed, dyConsumed, dxUnconsumed, dyUnconsumed);
                var floatingActionButtonChild = child.JavaCast<FloatingActionButton>();
                if (dyConsumed > 0 && floatingActionButtonChild.Visibility == ViewStates.Visible)
                else if (dyConsumed < 0 && floatingActionButtonChild.Visibility != ViewStates.Visible)

    But this behavior prevents the FAB from being pushed up when a snackbar message is present. Any ideas on how to implement both features?

    Thursday, August 11, 2016 6:41 AM

All replies

  • User14506 posted


    This resolved my issue.

    Friday, August 12, 2016 2:58 AM
  • User270307 posted

    Alright so you dont have to do all that.. All you have to do, in you XML containing the Floating Action button change the layout type ( "FrameLayout" as such) to

    <android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"

    and make sure you create an object of that in your activity as

    CoordinatorLayout LayoutMain;

    and add it to your SnackBar

                                .Make(LayoutMain, "Timer Deleted", Snackbar.LengthLong)
                                .SetAction("Undo", (view) => { db.insertIntoTablePerson(person); LoadData(); })
    Sunday, November 13, 2016 11:21 PM