我有一个ImageView
我正在添加的WindowManager.addView(ImageView, WindowManager.LayoutParams)
. 我想动画它出现在屏幕上的时间,但是当我调用该方法ImageView
时它似乎没有动画。下面是我的代码...ImageView.startAnimation(Animation)
addView()
image = new ImageView(context);
image.setImageResource(R.drawable.image);
image.setAlpha(180);
WindowManager.LayoutParams params = new WindowManager.LayoutParams(WindowManager.LayoutParams.WRAP_CONTENT,
WindowManager.LayoutParams.WRAP_CONTENT,
WindowManager.LayoutParams.TYPE_SYSTEM_OVERLAY, 0, PixelFormat.TRANSLUCENT);
windowManager.addView(image, params);
image.startAnimation(AnimationUtils.loadAnimation(getContext(), R.anim.grow));
这是grow.xml
<?xml version="1.0" encoding="UTF-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<scale android:fromXScale="0"
android:toXScale="1"
android:fromYScale="0"
android:toYScale="1"
android:pivotX="50%"
android:pivotY="50%"
android:duration="350"/>
<alpha android:fromAlpha="0.0" android:toAlpha="1.0" android:duration="350" />
</set>
图像只是出现在窗口中并且没有动画,有谁知道我怎样才能让图像动画?