この質問は以前に何度も聞かれたことは知っていますが、他のコードは私のものよりもかなり複雑であるか、異なっていたため、まったく理解できませんでした。質問が言うように...クリックする代わりにアニメーションを自動的に開始する方法..以下のコードを残しておいてください..よろしくお願いします..!!
final Animation a = AnimationUtils.loadAnimation(this, R.animator.animation);
a.reset();
final ImageView rImage = (ImageView) findViewById(R.id.title);
RelativeLayout layout = (RelativeLayout) findViewById(R.id.root);
layout.setOnClickListener(new OnClickListener() {
@Override public void onClick(View v) {
rImage.startAnimation(a);
func(); //A call to the function.
}
});