我想知道是否有一種方法讓它在執行按鈕動畫(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