Search code examples
androidanimationactionbarsherlockdialogfragment

DialogFragment animation not working for API <= 15


I'm trying to do a simple slide-in-left/slide-out-right animation for my dialog fragments. My fragments extend SherlockDialogFragment and I set the animation in onCreateDialog:

@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    Dialog dialog = super.onCreateDialog(savedInstanceState);
    dialog.getWindow().getAttributes().windowAnimations = R.style.dialog_animation;
    return dialog;
}

Problem is that the animation doesn't work phones with API <= 15. What am I missing here? Thanks.


Solution

  • There was nothing wrong with my code apparently. My test device had animation turned off. I just had to turn it back on, everything worked just fine after that was done.