想ImageView的动画完成后,开始活动 [英] want to start activity after completion of animation of imageview
本文介绍了想ImageView的动画完成后,开始活动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想旋转
的ImageView
然后我要开始活动$
的ImageView的C $ C>的onClick
但问题是,Android系统不给时间来完成动画
并开展活动。那么,怎样才能让我彻底再展动画调用活动。
这是我的XML code:
I want to rotate
imageview
and then I want to start activity
onClick of imageview
but the problem is that android system doesn't give the time to complete the animation
and launching the activity. So how can I show the animation completely and then calling the activity.
This is my xml code:
<?xml version="1.0" encoding="utf-8"?>
<rotate xmlns:android="http://schemas.android.com/apk/res/android"
android:duration="200"
android:fromDegrees="-7"
android:pivotX="50%"
android:pivotY="50%"
android:repeatMode="reverse"
android:toDegrees="7" />
这code:
And this code:
public void onImageViewClicked(View view){
switch(view.getId()){
case R.id.viewstock:
Animation shakeV = AnimationUtils.loadAnimation(this, R.anim.shake);
view.startAnimation(shakeV);
startActivityForResult(intent, 12);
break;
case R.id.about:
Animation shakeA = AnimationUtils.loadAnimation(this, R.anim.shake1);
view.startAnimation(shakeA);
Intent aboutIntent = new Intent(MainActivity.this,AboutActivity.class);
startActivity(aboutIntent);
break;
}
}
推荐答案
是啊,我的猜测是正确的。使用符合 shakeA,shakeV
解决方案
shakeA.setAnimationListener(new AnimationListener() {
这篇关于想ImageView的动画完成后,开始活动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文