Android,如何知道动画已经完成?
在我的项目中,我有一个按钮。当用户单击它时,它会显示动画,然后应该加载另一个活动。
@Override
public void onClick(View v) {
switch (v.getId()){
case R.id.btnReadPage:
startAnimation();
//stopAnimation();
//Toast.makeText(this, "Read Page Clicked", Toast.LENGTH_SHORT).show();
//startActivity(new Intent(this, ReadPage.class));
return;
}
}
根据上面的代码(startActivity,注释),当我运行应用程序并单击按钮时,动画将会播放。但如果我取消注释它,因为快速过渡动画不会显示。 我如何通知动画已完成? 谢谢
In my project i have a button. when user clicks on it, it shows and animation after that should load another activity.
@Override
public void onClick(View v) {
switch (v.getId()){
case R.id.btnReadPage:
startAnimation();
//stopAnimation();
//Toast.makeText(this, "Read Page Clicked", Toast.LENGTH_SHORT).show();
//startActivity(new Intent(this, ReadPage.class));
return;
}
}
according to above code(startActivity, commented), when I run the application and click on the button, animation will play. but if i uncomment it because of fast transition animation doesn't show.
How can i inform that animation is finished?
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
在您的动画对象上调用以下代码:
On your animation object call this code:
Kotlin 2023 更新。以下是拉胡尔卡皮尔的回答。
Update 2023 in Kotlin. Following Rahulkapil answer.