1

I'm writing a custom toast, and use a system style resource for animation.

WindowManager.LayoutParams lp = new WindowManager.LayoutParams();
lp.height = LayoutParams.WRAP_CONTENT;
lp.width = LayoutParams.WRAP_CONTENT;
lp.format = PixelFormat.TRANSLUCENT;
lp.flags = LayoutParams.FLAG_NOT_FOCUSABLE | LayoutParams.FLAG_NOT_TOUCHABLE;
lp.type = LayoutParams.TYPE_TOAST;
lp.windowAnimations = android.R.style.Animation_Translucent;
mWindowManager.addView(view, lp);

this does not anims for the enter animation but works for the exit animation, the android.R.style.Animation_Translucent defined as the following:

<style name="Animation.Translucent">
    <item name="windowEnterAnimation">@anim/translucent_enter</item>
    <item name="windowExitAnimation">@anim/translucent_exit</item>
</style>

Can someone helps, thanks!

last night i try again and have a different discovery. when in dark theme(holo) it works only for the exit animation, but in light theme(holo_light), it works well for enter and exit anims.

if i change to light theme, run the animation once, then change back to dark theme, it also works well for both anims. So strange it is.

kwf2030
  • 195
  • 2
  • 13
  • I wonder if [this question's answer](http://stackoverflow.com/questions/17745282/windowmanager-with-animation-is-it-possible) will help? –  Jul 08 '14 at 12:09
  • thanks, but this does not help. – kwf2030 Jul 10 '14 at 00:40

0 Answers0