博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
ListView 条目加载上滑下滑首尾缩放动画实现
阅读量:6909 次
发布时间:2019-06-27

本文共 828 字,大约阅读时间需要 2 分钟。

要实现这个效果,只需要再适配器getView之前,给每个条目的view设置相应的动画即可。

 

首先需要2个动画的xml文件。

在res下新建anim文件夹:(res/anim)

第一个动画xml文件:

 

up_from_bottom.xml

 

  

 

down_from_top.xml

 

  

在listview的适配器中使用定义的动画:

 

代码如下:

 

private int lastPosition = -1;@Overridepublic View getView(int position, View convertView, ViewGroup parent) {    //Load your view, populate it, etc...    View view = ...;    Animation animation = AnimationUtils.loadAnimation(getContext(), (position > lastPosition) ? R.anim.up_from_bottom : R.anim.down_from_top);    view.startAnimation(animation);    lastPosition = position;    return view;}

  

 

参考: http://kylewbanks.com/blog/Implementing-Google-Plus-Style-ListView-Animations-on-Android

If you are interested the animation,

you can check out the full source on , or download the project and try it out.

 

转载地址:http://bibcl.baihongyu.com/

你可能感兴趣的文章
获取当前操作的IFrame 对象的方法
查看>>
年月日下拉选择三级联动(闰年判断),时间获取方法总结,特殊:获取当前月天数...
查看>>
Tallest Cow(POJ3263)
查看>>
POJ—Building a Space Station
查看>>
杭电oj Problem-1013 Digital Roots
查看>>
CRM 2013 切换显示语言
查看>>
Codeforces Round #544 (Div. 3) C. Balanced Team
查看>>
UML-对象图
查看>>
【leetcode】1037. Valid Boomerang
查看>>
一起学Android之Layout
查看>>
PHP网页计时工具——SESSION问题
查看>>
PHP 真正多线程的使用
查看>>
ip黑白名单防火墙frdev的原理与实现
查看>>
ajax全接触
查看>>
ps查看内存占用排序
查看>>
【BZOJ】4873: [Shoi2017]寿司餐厅
查看>>
leetcode-852-山脉数组的峰顶索引
查看>>
你了解HTTPS,但你可能不了解X.509
查看>>
Bootstrap 类解析
查看>>
项目总结12:bootstrap-select下拉框模糊搜索
查看>>