To anyone looking out for answer in future..
Coordinator Layout used as Parent Layout of Floating Action Button will handle the animation effect for you automatically.
The floating action button has a default behavior that detects Snackbar views being added and animates the button above the height of the Snackbar accordingly.
Floating Action Button Behavior
<android.support.design.widget.CoordinatorLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/clayout">
<android.support.design.widget.FloatingActionButton
android:id="@+id/fab_btn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|right"
android:layout_marginBottom="16dp"
android:layout_marginRight="16dp"
android:src="@drawable/filter_icon"
app:rippleColor="@color/colorGray"
app:fabSize="normal"
app:borderWidth="0dp"/>
</android.support.design.widget.CoordinatorLayout>
Then our SnackBar code would use Coordinatorlayout[here clayout] as parentlayout like below:
Snackbar.make(clayout, "Click on row to know more details", Snackbar.LENGTH_LONG)
.setAction("OK", new View.OnClickListener() {
@Override
public void onClick(View v) {
}
}).show();
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…