anim文件夹下建立anim_layout.xml和alpha.xml

-----------------------android:animationOrder的取值有normal 0 默认reverse 1 倒序random 2 随机-----------------------

anim_layout.xml

[html] view plain copy
  1. <?xmlversion="1.0"encoding="utf-8"?>
  2. <layoutAnimationxmlns:android="http://schemas.android.com/apk/res/android"
  3. android:delay="0.5"
  4. android:animationOrder="random"
  5. android:animation="@anim/alpha"
  6. />

alpha.xml

[html] view plain copy
  1. <?xmlversion="1.0"encoding="utf-8"?>
  2. <setxmlns:android="http://schemas.android.com/apk/res/android"
  3. android:interpolator="@android:anim/accelerate_interpolator">
  4. <alpha
  5. android:fromAlpha="0.0"
  6. android:toAlpha="1.0"
  7. android:duration="500"/>
  8. </set>

布局文件里的ListView增加一个layoutAnimation属性

[java] view plain copy
  1. <?xmlversion="1.0"encoding="utf-8"?>
  2. <LinearLayoutxmlns:android="http://schemas.android.com/apk/res/android"
  3. android:layout_width="fill_parent"
  4. android:layout_height="fill_parent"
  5. android:orientation="vertical">
  6. <ListView
  7. android:id="@id/android:list"
  8. android:layout_width="fill_parent"
  9. android:layout_height="fill_parent"
  10. android:drawSelectorOnTop="false"
  11. android:layoutAnimation="@anim/anim_layout"
  12. ></ListView>
  13. <TextView
  14. android:id="@id/android:empty"
  15. android:layout_width="fill_parent"
  16. android:layout_height="fill_parent"
  17. android:text="Nodata"/>
  18. </LinearLayout>

更多相关文章

  1. Ubuntu 14.04 下 android studio 安装 和 配置
  2. Android的Layout --- 布局
  3. Android(安卓)PullZoomView:PullToZoomScrollViewEx(2)
  4. Android开发常见错误及技巧
  5. AndroidManifest.xml相关知识
  6. Android实现界面跳转功能
  7. android 动画调换上下布局

随机推荐

  1. 阅读《Android 从入门到精通》(2)——熟悉
  2. Android使用MQTT协议
  3. Android中实现整个视图切换的左右滑动效
  4. Android --spinner构造下垃菜单
  5. Android stdio调试程序闪退或者报错:"xxx
  6. 简单的修改Android DigitalClock
  7. 解决 Unable to read repository at http
  8. Android BlueDroid(二):BlueDroid蓝牙开启过
  9. android ConcurrentHashMap的使用
  10. android动画之android:interpolator属性