Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android how to set windowanimation programmatically

I can set animation do dialog using xml like following

Dialog myDialog;
        myDialog.getWindow().setWindowAnimations(R.style.Animations_sample);

How can I add programmatically created animation to Dialog?
What I mean is I created a animation like following

 AnimationSet animationSet = new AnimationSet(true);

        TranslateAnimation a = new TranslateAnimation(
                Animation.ABSOLUTE,200, Animation.ABSOLUTE,200,
                Animation.ABSOLUTE,200, Animation.ABSOLUTE,200);
        a.setDuration(1000);
        animationSet.addAnimation(a);


how can I set animationSet to myDialog?


Thanks in adv.

like image 298
Sandy Avatar asked Oct 06 '22 16:10

Sandy


1 Answers

According to google:

windowAnimations

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.

like image 199
Zeus Monolitics Avatar answered Oct 11 '22 11:10

Zeus Monolitics