我想rotate
imageview
然后我想开始activity
onClickimageview
但问题是android系统没有时间来完成animation
和启动活动。那么我怎样才能完全显示动画然后调用活动。这是我的 xml 代码:
<?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" />
而这段代码:
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;
}
}