android view控件的显示和隐藏动画效果
2015-11-02 15:05
786 查看
// 显示动画
mShowAction = 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);
mShowAction.setRepeatMode(Animation.REVERSE);
mShowAction.setDuration(500);
// 隐藏动画
mHiddenAction = 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);
mHiddenAction.setDuration(500);
btn_setting.startAnimation(mShowAction);//开始动画
mShowAction = 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);
mShowAction.setRepeatMode(Animation.REVERSE);
mShowAction.setDuration(500);
// 隐藏动画
mHiddenAction = 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);
mHiddenAction.setDuration(500);
btn_setting.startAnimation(mShowAction);//开始动画
相关文章推荐
- 如何搭建AndroidStudio开发环境
- 关于博客更新及Android记事本源码问题
- Android 简单特殊知识点
- Android Studio教程07-SVN的使用(项目管理与控制)
- Android 系统联系人全特效实现(下),字母表快速滚动
- ubuntu 14.04.03 安装android环境
- android Paint之setXfermode方法
- android json的封装
- Android 学习路线
- Android判断gps是否打开
- android Intent机制详解
- Android 常见的第三方推送
- Android点击事件的分发
- Android 图形用户界面 之 绘图(二) Paint类 主要方法介绍
- Android 图形用户界面 之 绘图(一)
- Android画布(cavas)
- Android图片添加标签:Android-PictureTagView
- Android中使用Handler造成内存泄露的原因和解决方法
- Android Rect和RectF的区别
- android viewpager轮播图无限循环