Can I play frame animation in Toast view?
Lines 3-5 in the code below is what usually works for me if I want to play a frame animation in a view. Unfortunately, when I try to apply this view to a toast object, it does not liven up when a toast is displayed. Does anyone know if it is possible to play a frame animation on a toast? If so, how? thank
LayoutInflater inflaterSpin = getLayoutInflater();
View layout = inflaterSpin.inflate(R.layout.toast_layout, (ViewGroup) findViewById(R.id.toast_layout_root));
layout.setBackgroundResource(R.anim.anim_toast);
AnimationDrawable toastAnim = (AnimationDrawable) layout.getBackground();
toastAnim.start();
myToast = new Toast(getApplicationContext());
myToast.setView(layoutSpin);
myToast.show();
source
share