我想知道是否有一种方法让它在执行按钮动画(pulsingAnimation.start())后等待2-3秒,以便在这三秒钟后它将执行下一个代码创建一个意图并开始一项新活动/完成最后一项活动。这是我的代码。请帮忙,谢谢!按钮动画后,如何让下一个活动等待几秒钟?
final Button Metric = (Button) findViewById(R.id.button2);
final RelativeLayout r = (RelativeLayout) findViewById(R.id.relativeLayout6);
final ObjectAnimator pulsingAnimation = ObjectAnimator.ofPropertyValuesHolder(r,
PropertyValuesHolder.ofFloat("scaleX", 1.2f),
PropertyValuesHolder.ofFloat("scaleY", 1.2f));
pulsingAnimation.setRepeatCount(ObjectAnimator.INFINITE);
pulsingAnimation.setRepeatMode(ObjectAnimator.REVERSE);
Metric.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
pulsingAnimation.start();
Intent i = new Intent(MainActivity.this, Metric.class);
startActivity(i);
finish();
}
});
我想,它想出了一个异常错误 –
哪个异常? – Stefano