/**
* 向上滑出
*/
private TranslateAnimation showAction = new TranslateAnimation(Animation.RELATIVE_TO_SELF, 0.0f,
Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF,
1.0f, Animation.RELATIVE_TO_SELF, 0.0f);
/**
* 向下隐藏
*/
private TranslateAnimation hideAction = new TranslateAnimation(Animation.RELATIVE_TO_SELF, 0.0f,
Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF,
0.0f, Animation.RELATIVE_TO_SELF, 1.0f);
使用方式
showAction.setDuration(200);
linearLayout.startAnimation(showAction);
本文介绍如何使用TranslateAnimation在Android中实现视图的向上滑出和向下滑动隐藏效果,通过设置动画属性和持续时间,轻松为应用界面增添动态元素。

被折叠的 条评论
为什么被折叠?



