可以在设置最终图像之前不断更改图像。
我想在翻转时改变图像。 所以翻转时看起来很光滑
private ImageView image;
private void images() {
int[] ps={R.drawable.img1,R.drawable.img2};
Random r = new Random();
int n=r.nextInt(2);
image.setImageResource(ps[n]);
ObjectAnimator animation = ObjectAnimator.ofFloat(coin, "rotationY", 0f, 360f);
animation.setDuration(500);
animation.setInterpolator(new AccelerateDecelerateInterpolator());
animation.start();
}
答案 0 :(得分:0)
是的,你可以这样做,你应该使用翻转动画,你可以从Here找到这个代码 借助上述链接
在res/animator
中创建XML文件
比java文件
ObjectAnimator anim = (ObjectAnimator)
AnimatorInflater.loadAnimator(mContext, R.animator.[FILE NAME]);
int[] ps={R.drawable.img1,R.drawable.img2};
Random r = new Random();
int n=r.nextInt(2);
image.setImageResource(ps[n]);
anim.setTarget(image);
anim.setDuration(500);
anim.start();