Here's a simple way to add SnackBar using CoordinatorLayout from top of the screen but animation is still an issue.
Simply add a CoordinatorLayout layout to your layout like:
<android.support.design.widget.CoordinatorLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:id="@+id/snackbarlocation">
</android.support.design.widget.CoordinatorLayout>
and then in your Activity get a reference to it and pass it to the SnackBar as below:
CoordinatorLayout Clayout = (CoordinatorLayout)findViewById(R.id.snackbarlocation);
FabButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Snackbar.make(Clayout, "This snack bar located at top", Snackbar.LENGTH_SHORT).show();
}
});
Credits