How to create a Snackbar like in the material documentation?

how to create those "offset Snackbars"?

You can get the LayoutParams of SnackBar and add Bottom and Side Margin to it

Try out like code below

public static void showSnackbar(Snackbar snackbar, int sideMargin, int marginBottom) {
    final View snackBarView = snackbar.getView();
    // Depend upon your parent Layout Use `LayoutParams` of that Layout
    final FrameLayout.LayoutParams params = (FrameLayout.LayoutParams) snackBarView.getLayoutParams();

    params.setMargins(params.leftMargin + sideMargin,
                params.topMargin,
                params.rightMargin + sideMargin,
                params.bottomMargin + marginBottom);

    snackBarView.setLayoutParams(params);
    snackbar.show();
}