下面介绍一个listview item 的一款比较炫酷的动画,首先呢在res下建一个anim 的文件,然后创建一个list_side_right.xml如下:
<?xml version="1.0" encoding="utf-8"?>
<layoutAnimation xmlns:android="http://schemas.android.com/apk/res/android"
android:animation="@anim/side_right"
android:animationOrder="reverse"
android:delay="30%"></layoutAnimation>
然后在建一个side_right.xml 的文件
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:interpolator="@android:anim/accelerate_interpolator">
<translate
android:duration="500"
android:fromXDelta="100%p"
android:toXDelta="0%p" />
</set>
在Activity.xml 下如;
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" android:id="@+id/activity_main"
android:layout_width="match_parent" android:layout_height="match_parent"
>
<ListView
android:id="@+id/list"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layoutAnimation="@anim/list_side_right"
/>
</RelativeLayout>
以上就实现了item内容的依次平移。