アクティビティが開始されるとすぐにアニメーションを開始したいと思います。そして、アニメーションが終了するとすぐに、別のアクティビティを開始したいので、私は多くを検索し、誰もがonAnimationEnd()を使用することを推奨しました。ただし、コードを実行すると、アニメーションが終了した後に新しいアクティビティは表示されません。誰かが私のエラーを指摘できますか?ここで アニメーションの終了後にアクティビティを変更するにはどうすればよいですか?アニメーションリスナーが動作していないようです
は私のMainActivity.java
public class MainActivity extends AppCompatActivity implements Animation.AnimationListener {
TextView ticTacToe;
Animation animation;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
ticTacToe = (TextView) findViewById(R.id.tictactoe);
//bounce is the xml animation file
animation= AnimationUtils.loadAnimation(getApplicationContext(),
R.anim.bounce);
}
@Override
public void onWindowFocusChanged(boolean hasFocus) {
super.onWindowFocusChanged(hasFocus);
if (hasFocus)
ticTacToe.startAnimation(animation);
}
@Override
public void onAnimationStart(Animation animation) {
}
@Override
public void onAnimationEnd(Animation animation) {
Intent intent = new Intent(this,Main2Activity.class);
startActivity(intent);
}
@Override
public void onAnimationRepeat(Animation animation) {
}
}
はあなたの開始アニメーションが動作していますか? –
はい。それは完全に動作しています –