AnimatorSet的使用
来源:互联网 发布:淘宝买家秀模特兼职 编辑:程序博客网 时间:2024/06/06 21:03
这个场景其实就是一个用户的头像选择,最中间的为用户默认的头像,点击四周头像可以与中间的头像进行交换。交换的过程就是用到了Android动画中AnimationSet这个类。
onClick事件具体执行内容:
private void switchImage(ImageView image){ if(!animSet.isStarted() && image.getId()!=img_center.getId()){ //判断动画是否在运行,并且点击图片若在中间则不交换 ObjectAnimator anim1, anim2, anim3, anim4, anim5, anim6, anim7, anim8, anim21, anim61; animSet = new AnimatorSet(); anim1 = ObjectAnimator.ofFloat(image, "alpha", 0.2f, 1f); anim2 = ObjectAnimator.ofFloat(image, "y", image.getY() , img_center.getY()); anim21 = ObjectAnimator.ofFloat(image, "x", image.getX() , img_center.getX()); anim3 = ObjectAnimator.ofFloat(image, "scaleX", 1.0f, 1.2f); anim4 = ObjectAnimator.ofFloat(image, "scaleY", 1.0f, 1.2f); anim5 = ObjectAnimator.ofFloat(img_center, "alpha", 1f, 0.2f); anim6 = ObjectAnimator.ofFloat(img_center, "y", img_center.getY() , image.getY()); anim61 = ObjectAnimator.ofFloat(img_center, "x", img_center.getX() , image.getX()); anim7 = ObjectAnimator.ofFloat(img_center, "scaleX", 1f, 0.8f); anim8 = ObjectAnimator.ofFloat(img_center, "scaleY", 1f, 0.8f); animSet.play(anim1).with(anim2).with(anim3).with(anim4) .with(anim5).with(anim6).with(anim7).with(anim8).with(anim21).with(anim61); animSet.setDuration(1000); animSet.start(); imgs.put(img_center, imgs.get(image)); imgs.put(image, 22); image.setPadding(15,15,15,15); img_center.setPadding(0,0,0,0); img_center = image; System.out.println("center_id:"+img_center.getId()); } }
0 0
- AnimatorSet的使用
- android 属性动画 AnimatorSet的使用
- 仿直播间玩色子游戏,AnimatorSet的综合使用
- AnimatorSet
- android AnimatorSet AnimationSet 的区别
- android AnimatorSet AnimationSet 的区别
- 使用AnimatorSet控制动画执行顺序
- android AnimatorSet AnimationSet 的运行时间差异
- android 4.0.x上AnimatorSet.setDuration上的坑
- AnimatorSet 动画集合以及它的监听事件
- 动画AnimatorSet
- AnimatorSet库
- Android自定义控件:动画类(十)----AnimatorSet联合动画的代码实现
- AnimatorSet.setDuration问题
- PropertyValuesHolder和AnimatorSet
- Android 动画之AnimatorSet
- 动画[5]PropertyAnimator AnimatorSet
- android 动画AnimationSet 和 AnimatorSet
- Min Stack
- 按钮的单选框
- 批量处理SQL语句
- 输出字符串所有组合(含有重复的字符)及输出其所有子串(含有重复的字符)
- 数据挖掘150道试题 测测你的专业能力过关吗?
- AnimatorSet的使用
- 路由及路由器工作原理深入解析1:概述
- android关于点九图的制作
- 九度oj 1076
- POJ 2488:A Knight's Journey 深搜入门之走马观花
- HDU 1166 敌兵布阵 线段树 部分和 点更新
- [转]含有汉字,数字,字母,下划线的正则表达式
- 【leetcode】Minimum Size Subarray Sum
- HDU 5327 Olympiad