不可以那样做的,需要WindowManager.LayoutParams中设置,并且还是有限制的,例如LayoutParams.windowAnimations = android.R.style.Animation_Dialog;
注意api中的这段话A style resource defining the animations to use for this window. This must be a system resource; it can not be an application resource because the window manager does not have access to applications.