public void AnimR(){
if(null == taR) {
taR = new TranslateAnimation(Animation.RELATIVE_TO_SELF, 0, Animation.RELATIVE_TO_SELF, 0.9f, Animation.RELATIVE_TO_SELF, 0, Animation.RELATIVE_TO_SELF, 0);
taR.setDuration(200);
taR.setFillAfter(true);
alO = new AlphaAnimation(1, 0.2f); //0表示完全透明。1表示不透明
alO.setDuration(200);
alO.setFillAfter(true);
setR = new AnimationSet(false);
setR.addAnimation(taR);
setR.addAnimation(alO);
setR.setFillAfter(true);
}
iv_fast_appoint.startAnimation(setR); //iv表示动画显示显示在哪个地方 通过findviewbyid拿到
}
public void AnimL(){
if(null == taL) {
taL = new TranslateAnimation(Animation.RELATIVE_TO_SELF, 0.9f, Animation.RELATIVE_TO_SELF, 0, Animation.RELATIVE_TO_SELF, 0, Animation.RELATIVE_TO_SELF, 0);taL.setDuration(200);
taL.setFillAfter(true);
taL.setDuration(200);
alT = new AlphaAnimation(0.2f, 1); //0表示完全透明。1表示不透明
alT.setDuration(200);
alT.setFillAfter(true);
setL = new AnimationSet(false);
setL.addAnimation(taL);
setL.addAnimation(alT);
setL.setFillAfter(true);
}
iv_fast_appoint.startAnimation(setL); //iv表示动画显示显示在哪个地方 通过findviewbyid拿到
setL.setAnimationListener(new Animation.AnimationListener() {
@Override
public void onAnimationStart(Animation animation) {
}
@Override
public void onAnimationEnd(Animation animation) {
canSrcollR = true;
}
@Override
public void onAnimationRepeat(Animation animation) {
}
});
}
动画延迟的话可以通过
setStartOffset这个方法设置动画延迟时间