listView 的item添加动画

android listview的item添加动画

LayoutAnimationsController

1、什么是LayoutAnimationsController

LayoutAnimationsController可以用于实现使多个控件按顺序一个一个的显示。

1)LayoutAnimationsController用于为一个layout里面的控件,或者是一个ViewGroup里面的控件设置统一的动画效果。

2)每一个控件都有相同的动画效果

3)控件的动画效果可以在不同的时间显示出来

4)LayoutAnimationsController可以在xml文件当中设置,也可以在代码当中进行设置。

2、在xml当中使用LayoutAnimationController

1)在res/anim文件夹下创建一个名为list_anim_layout.xml文件:

android:dylay -动画间隔时间;

android:animationOrder -动画执行的循序(normal:顺序,random:随机,reverse:反向显示)

android:animation –引用动画效果文件

<layoutAnimation
   xmlns:android="http://schemas.android.com/apk/res/android"
   android:delay="0.5"
   android:animationOrder="normal"
   android:animation="@anim/list_anim"/>

2)创建list_anim.xml文件,设置动画效果

复制代码
<?xmlversion="1.0"encoding="utf-8"?>
<setxmlns:android="http://schemas.android.com/apk/res/android"
   android:interpolator="@android:anim/accelerate_interpolator"
   android:shareInterpolator="true">
   <alpha
      android:fromAlpha="0.0"
      android:toAlpha="1.0"
      android:duration="1000"/>
</set>
复制代码

3)在布局文件main.xml当中为ListVIew添加如下配置

<ListView
      android:id="@id/android:list"
      android:layout_width="fill_parent"
      android:layout_height="wrap_content"
      android:scrollbars="vertical"
      android:layoutAnimation="@anim/list_anim_layout"/>

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值