locked
Floating Button with snackbar RRS feed

Answers

  • User270307 posted

    So this is how I raised my Floating Action Button when a snack bar appear: It is pretty simple actually.

    in your XML containing the Floating Action button change the layout type ( "<FrameLayout" as such) to <android.support.design.widget.CoordinatorLayout this is where all the magic happens

    <android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:app="http://schemas.android.com/apk/res-auto"
        xmlns:tools="http://schemas.android.com/tools"
        android:id="@+id/frameLayoutMain" 
        android:layout_width="match_parent"
        android:layout_height="match_parent">
    

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

    CoordinatorLayout LayoutMain;
    

    and add it to your SnackBar

    Snackbar
                                .Make(LayoutMain, "Deleted", Snackbar.LengthLong)
                                .SetAction("Undo", (view) => {  })
                                     .Show();
    
    • Marked as answer by Anonymous Thursday, June 3, 2021 12:00 AM
    Sunday, November 13, 2016 11:28 PM