이 작업을 수행하는 방법에 대한 대략적인 아이디어가 이미 있으며 Image View 또는 Text View 당 2 개 이상의 애니메이션 세트를 만드는 것이라고 생각하지만 코드가 길어질 것입니다. 코드를 최소화 할 수있는 방법이 있습니까? 다음은 모든 이미지보기 및 텍스트보기에 대한 코드입니다.
AnimationSet setA = new AnimationSet(true);
fadeIn1.setDuration(1000);
setA.addAnimation(fadeIn1);
TranslateAnimation Trans1 = new TranslateAnimation(270, 0, 0, 0);
Trans1.setDuration(1000);
setA.addAnimation(Trans1);
ImageView1.startAnimation(setA);
//how do i place delay here??
ImageView2.startAnimation(setA);
//how do i place delay here??
TextView1.startAnimation(setA);
//how do i place delay here??
TextView2.startAnimation(setA);
//how do i place delay here??
setA.setAnimationListener(new Animation.AnimationListener() {
@Override
public void onAnimationStart(Animation animation) {
}
@Override
public void onAnimationEnd(Animation animation) {
ImageView1.clearAnimation();
ImageView2.clearAnimation();
TextView1.clearAnimation();
TextView2.clearAnimation();
}
@Override
public void onAnimationRepeat(Animation animation) {
}
});
핸들러를 사용하여 지연시킬 수 있습니다. 예 :
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
ImageView1.startAnimation(setA);
}
}, 2000);
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
ImageView2.startAnimation(setA);
}
}, 4000);
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다