我有两个要交叉淡入淡出的图像。最初他们都使用 imageview。然后我使用 .getDrawable() 来获取图像的可绘制对象。
这是我使用的代码
Drawable backgrounds[] = new Drawable[2];
backgrounds[0] = BackgroundImage.getDrawable();
backgrounds[1] = BackgroundImageBlurred.getDrawable();
TransitionDrawable crossfader = new TransitionDrawable(backgrounds);
crossfader.startTransition(3000);
它只显示第一个数组元素上的图像,因为这两个图像在 XML 中都设置为可见,所以它无论如何都会显示。
过渡没有开始
任何帮助,将不胜感激 :)