I have checked all the Stack Overflow Q/A on this, still can't find a solution.

Here are the files:

DialogFragment.java

```
package app.com.thetechnocafe.mealsquickie.Dialogs;

import android.app.Dialog;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.design.widget.TextInputEditText;
import android.support.design.widget.TextInputLayout;
import android.support.v4.app.DialogFragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.Toast;

import app.com.thetechnocafe.mealsquickie.R;
import butterknife.BindView;
import butterknife.ButterKnife;

/**
 * Created by gurleensethi on 26/01/17.
 */

public class NewCategoryDialog extends DialogFragment {

    @BindView(R.id.category_name_text_input_layout)
    TextInputLayout mCategoryNameTextInputLayout;
    @BindView(R.id.category_name_text_input_edit_text)
    TextInputEditText mCategoryNameTextInputEditText;
    @BindView(R.id.cancel_button)
    Button mCancelButton;
    @BindView(R.id.add_button)
    Button mAddButton;

    private OnAddCategoryListener mListener;

    //Interface for callbacks
    public interface OnAddCategoryListener {
        void onCategoryAdded(String category);
    }

    //Instance method
    public static NewCategoryDialog getInstance() {
        return new NewCategoryDialog();
    }

    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        //Inflate the custom dialog
        View root = LayoutInflater.from(getContext()).inflate(R.layout.dialog_new_category, container, false);

        ButterKnife.bind(this, root);

        setEventListeners();

        //Set properties
        getDialog().requestWindowFeature(STYLE_NO_TITLE);
        setCancelable(false);

        return root;
    }

    @Override
    public void onStart() {
        super.onStart();
        getDialog().getWindow().setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
    }

    private void setEventListeners() {
        mCancelButton.setOnClickListener(view -> getDialog().dismiss());

        mAddButton.setOnClickListener(view -> validateAndSubmitFields());
    }

    private void validateAndSubmitFields() {
        if (mListener != null) {
            //Remove all the already existing errors
            mCategoryNameTextInputLayout.setErrorEnabled(false);

            String category = mCategoryNameTextInputEditText.getText().toString();

            if (category.equals("")) {
                mCategoryNameTextInputLayout.setError(getString(R.string.category_name_cannot_be_empty));
                return;
            }

            mListener.onCategoryAdded(category);
        } else {
            Toast.makeText(getContext(), "No Listener attached for adding new category. Please contact the developer.", Toast.LENGTH_SHORT).show();
        }
    }

    @NonNull
    @Override
    public Dialog onCreateDialog(Bundle savedInstanceState) {
        Dialog dialog = super.onCreateDialog(savedInstanceState);

        dialog.getWindow().getAttributes().windowAnimations = R.style.DialogSlideFromBottomAnimation;
        return dialog;
    }
}

```

slide\_down.xml

```
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
    <translate
        android:duration="1000"
        android:fromYDelta="0%"
        android:interpolator="@android:anim/accelerate_interpolator"
        android:toYDelta="100%" />
</set>

```

slide\_up.xml

```
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
    <translate
        android:duration="1000"
        android:fromYDelta="100%"
        android:interpolator="@android:anim/accelerate_interpolator"
        android:toYDelta="0%" />
</set>

```

Showing the dialog:

```
DialogFragment dialog = NewCategoryDialog.getInstance();
dialog.show(getFragmentManager(), DIALOG_NEW_CATEGORY_TAG);

```

I have tried both `getAttributes().windowAnimations` and `setWindowAnimations()`, and have also tried it putting it in onActivityCreated, onCreateDialog, onCreateView, but it doesn't seem to work.