Android 值动画使用三
发布日期:2021-06-30 22:37:24
浏览次数:2
分类:技术文章
本文共 1649 字,大约阅读时间需要 5 分钟。
说明:
1)mImageView.getHeight() 图片填充后的高度,即ImageView在容器里的高度 2)mBitmapHeight图片原来的高度 3)animation.getAnimatedFraction() 就是动画运行过程中的变化因子(从0到1) 4)mImageView.requestLayout()表示重新设定ImageView的布局 5)animator.setInterpolator(new OvershootInterpolator(4)) 动画加速器,有快速弹出的效果—————————————————–
(java 架构师全套教程,共760G, 让你从零到架构师,每月轻松拿3万) 请先拍 , 下载请用百度盘 目录如下: 01.高级架构师四十二个阶段高 02.Java高级系统培训架构课程148课时 03.Java高级互联网架构师课程 04.Java互联网架构Netty、Nio、Mina等-视频教程 05.Java高级架构设计2016整理-视频教程 06.架构师基础、高级片 07.Java架构师必修linux运维系列课程 08.Java高级系统培训架构课程116课时 (送:hadoop系列教程,java设计模式与数据结构, Spring Cloud微服务, SpringBoot入门) 01高级架构师四十二个阶段高内容: 01高级架构师四十二个阶段高内容: —————————————————–代码:
switch (ev.getAction()) { case MotionEvent.ACTION_UP: final int startHeight = mImageView.getHeight(); final int endHeight = mBitmapHeight; ValueAnimator animator = ValueAnimator.ofInt(1); animator.addUpdateListener(new AnimatorUpdateListener() { @Override public void onAnimationUpdate(ValueAnimator animation) { float fraction = animation.getAnimatedFraction(); int newHeight = (int) (evalute(fraction, startHeight, endHeight) + 0.5f); mImageView.getLayoutParams().height = newHeight; mImageView.requestLayout(); } }); animator.setInterpolator(new OvershootInterpolator(4)); animator.setDuration(500); animator.start();}/** * 估值器,得到移动后的位置 * * @param percent * @param startValue * @param endValue * @return */ public Float evalute(float percent, Number startValue, Number endValue) { float start = startValue.floatValue(); return start + percent * (endValue.floatValue() - start); }
转载地址:https://lovoo.blog.csdn.net/article/details/51527420 如侵犯您的版权,请留言回复原文章的地址,我们会给您删除此文章,给您带来不便请您谅解!
发表评论
最新留言
逛到本站,mark一下
[***.202.152.39]2024年04月10日 23时09分01秒
关于作者
喝酒易醉,品茶养心,人生如梦,品茶悟道,何以解忧?唯有杜康!
-- 愿君每日到此一游!
推荐文章
hihocoder 1555 四次方根(矩阵快速幂)
2019-04-30
codeforces 449 D Jzzhu and Numbers(容斥+dp)
2019-04-30
Gym - 101334E Exploring Pyramids(dp+分治)
2019-04-30
hdu 6183 Color it(cdq分治+线段树)
2019-04-30
gym 101137 L Lazy Coordinator(概率)
2019-04-30
Mysql 入门
2019-04-30
Vue 之 axios 篇
2019-04-30
vue 之动画
2019-04-30
js的基础语法
2019-04-30
vue使用iconfont
2019-04-30
linux 查看文件夹权限
2019-04-30
linux tar 备份
2019-04-30
ubuntu中配置任意应用的快捷键
2019-04-30
ln 命令 硬链接
2019-04-30
chkconfig使用和级别介绍
2019-04-30
ubuntu 快捷键
2019-04-30
linux 根目录下文件夹分析
2019-04-30
My notes about backup to ubuntu
2019-04-30
linux 查看分区和文件大小
2019-04-30