私はしばらく探していましたが、Android コードの有効な解決策が見つかりません。まあ、少なくとも私が実装できるもの。
いくつかのアニメーションを含むアクティビティ (StartActivity) があります。次に、onTouchEvent があります。これは、さらにいくつかのアニメーションを促すには問題なく機能しますが、この後、新しいアクティビティを開きたいと思います。
これが私のコードです:
public class StartActivity extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.start);
RunAnimations(R.anim.translate1, R.anim.translate2);
}
public void RunAnimations(int t1, int t2) {
Animation a = AnimationUtils.loadAnimation(this, t1);
a.reset();
Animation b = AnimationUtils.loadAnimation(this, t2);
b.reset();
ImageView drop = (ImageView) findViewById(R.id.drop);
ImageView iflush = (ImageView) findViewById(R.id.iflush);
drop.clearAnimation();
iflush.clearAnimation();
drop.startAnimation(a);
iflush.startAnimation(b);
}
@Override
public boolean onTouchEvent(MotionEvent event) {
if (event.getAction() == MotionEvent.ACTION_DOWN) {
RunAnimations(R.anim.translate3, R.anim.translate4);
}
return true;
}
}
onTouchEvent では、RunAnimations を呼び出した後、新しいアクティビティ (TipActivity) を開始したいと考えています。それだけです。