public BottomViewHideShowAnimation(View view, boolean toVisible, long duration) {
super(false);
this.toVisible = toVisible;
this.animationView = view;
//Creates the Alpha animation for the transition
float startAlpha = toVisible ? 0 : 1;
float endAlpha = toVisible ? 1 : 0;
AlphaAnimation alphaAnimation = new AlphaAnimation(startAlpha, endAlpha);
alphaAnimation.setDuration(duration);
//Creates the Translate animation for the transition
int startY = toVisible ? getHideShowDelta(view) : 0;
int endY = toVisible ? 0 : getHideShowDelta(view);
TranslateAnimation translateAnimation = new TranslateAnimation(0, 0, startY, endY);
translateAnimation.setInterpolator(toVisible ? new LinearOutSlowInInterpolator() : new FastOutLinearInInterpolator());
translateAnimation.setDuration(duration);
//Adds the animations to the set
addAnimation(alphaAnimation);
addAnimation(translateAnimation);
setAnimationListener(new Listener());
}
BottomViewHideShowAnimation.java 文件源码
java
阅读 20
收藏 0
点赞 0
评论 0
项目:ExoMedia
作者:
评论列表
文章目录