android Animation 动画效果收集
2016-02-19 17:41
369 查看
1.点击后放大缩小实现
Android的事件:onClick, onScroll, onFling等等,都是由许多个Touch组成的。其中Touch的第一个状态肯定是ACTION_DOWN, 表示按下了屏幕。之后,touch将会有后续事件
对控件进行设置点击事件
findViewById(R.id.layout_click).setOnTouchListener(this);
findViewById(R.id.layout_click).setOnClickListener(this);
Android的事件:onClick, onScroll, onFling等等,都是由许多个Touch组成的。其中Touch的第一个状态肯定是ACTION_DOWN, 表示按下了屏幕。之后,touch将会有后续事件
对控件进行设置点击事件
findViewById(R.id.layout_click).setOnTouchListener(this);
findViewById(R.id.layout_click).setOnClickListener(this);
@Override public boolean onTouch(View v, MotionEvent event) { switch (event.getAction()) { case MotionEvent.ACTION_DOWN: // if(v.getId()==R.id.layout_click){ Animation animation=new ScaleAnimation(1.0f, 0.9f, 1.0f, 0.9f, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f); animation.setDuration(100); animation.setFillAfter(true); v.startAnimation(animation); } break; case MotionEvent.ACTION_UP: // if(v.getId()==R.id.layout_click){ Animation animation=new ScaleAnimation(0.9f, 1.0f, 0.9f, 1.0f, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f); animation.setDuration(100); animation.setFillAfter(true); v.startAnimation(animation); } break; default: break; } return false; }
相关文章推荐
- Android 动画之AlphaAnimation应用详解
- Android实现动画效果详解
- Android动画之3D翻转效果实现函数分析
- BaseAnimation是基于开源的APP,致力于收集各种动画效果(最新版本1.2)
- 关于TranslateAnimation()的参数问题
- Android的屏幕切换动画
- Android动画学习笔记-Android Animation
- Android动画笔记
- Android动画之translate(位移动画)
- Android动画之Drawable Animation
- 值动画
- Android常用动画
- Android布局动画和逐帧动画
- 收集android上开源的酷炫的交互动画和视觉效果
- 动画的简单介绍
- Android控件动画
- Interpolator的几种属性
- Android动画之Tween动画实现
- Android Animation动画详解(一): 补间动画
- Android Animation动画实战(一): 从布局动画引入ListView滑动时,每一Item项的显示动画