ViewGroup等空间的动画效果实战
常常我们会为一些空间制定动画效果,当然也能在布局空间中制定动画效果:
如:
<ListView
android:id="@android:id/list"
android:persistentDrawingCache="animation|scrolling"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layoutAnimation="@anim/layout_bottom_to_top_slide" />
android:layoutAnimation="@anim/layout_bottom_to_top_slide" 制定了该组建显示的时候的动画效果
layoutAnimation指定了前面定义的LayoutAnimationController,为了使动画效果比较流畅这里还通过persistentDrawingCache设置了控件的绘制缓存策略,一共有4中策略:
PERSISTENT_NO_CACHE 说明不在内存中保存绘图缓存;
PERSISTENT_ANIMATION_CACHE 说明只保存动画绘图缓存;
PERSISTENT_SCROLLING_CACHE 说明只保存滚动效果绘图缓存
PERSISTENT_ALL_CACHES 说明所有的绘图缓存都应该保存在内存中。

layout_bottom_to_top_slide 的代码如下
<layoutAnimation xmlns:android="http://schemas.android.com/apk/res/android"
android:delay="70%"
android:animationOrder="random"
android:animation="@anim/slide_right" />
android:delay子类动画时间间隔 (延迟) 70% 也可以是一个浮点数 如“1.2”等
android:animationOrder="random" 子类的显示方式 random表示随机
android:animationOrder 的取值有
normal 0 默认
reverse 1 倒序
random 2 随机
android:animation="@anim/slide_right" 表示孩子显示时的具体动画是什么

slide_right.xml
<set xmlns:android="http://schemas.android.com/apk/res/android" android:interpolator="@android:anim/accelerate_interpolator">
<translate android:fromXDelta="-100%p" android:toXDelta="0"
android:duration="@android:integer/config_shortAnimTime" />
</set>
不用解释了啥 就是动画又左边显示出来
中上所述 显示的效果为ListView第一次出现的时候为 item随机出现 每个Item都是从左不可见(-100%p)的区域向右滑动到显示的地方

转载请注明:来源于http://hi.baidu.com/adnroidorg/home

更多相关文章

  1. Android分享界面制作(底部滑出动画)
  2. Android——为某个控件或者LinearLayout等添加水波纹效果
  3. Android(安卓)ActionBar中的按钮添加旋转动画
  4. Android清除本地数据缓存代码案例
  5. 一个不错的启动菜单显示屏动画效果
  6. Android中Activity跳转和切换动画
  7. Android(安卓)Design Support Library使用详解(二)
  8. Android通过selector改变界面状态
  9. Android(安卓)中 PopupWindow的用法 汇总

随机推荐

  1. Android应用开发——跑马灯效果
  2. 【Android】界面布局之TableLayout(表格
  3. Android(安卓)SDK: adb 常用命令的使用(无
  4. Android Window 9问9答
  5. Android Activity是如何启动的?Activity的
  6. Android中显示gif动态图片
  7. Android(安卓)如何将一个button放在屏幕
  8. Android中矢量图使用
  9. HTC Kaiser 上如何安装运行Android
  10. Activity总体介绍