• Android之Animations的高级使用


    LayoutAnimationController的作用:

    A.  用于为一个layout里面的控件,或者是一个ViewGroup里面的控件设置动画效果

    B. 每一个控件都有相同的动画效果

    C. 这些控件的动画效果在不用的时间显示出来

     

    在xml当中使用LayoutAnimationController的具体步骤:

    1. 在res/anim文件夹当中创建一个新文件,名为list_anim_layout.xml(自定义名字)文件:以下是例子

    <layoutAnimation

    xmlns:android="http://schemas.android.com/apk/res/android"

    android:delay="0.5"

    android:animationOrder="random"

    android:animation="@anim/list_anim" />

    2. 在布局文件当中为使用动画的ListView添加如下配置,:

    android:layoutAnimation="@anim/list_anim_layout" 

    在代码当中使用LayoutAnimationController

    1. 创建一个Animation对象:可以通过装载xml文件(AnimationUtils.loadAnimation),或者直接使用Animation的构造函数创建Animation对象

    2. 使用如下代码创建LayoutAnimationController对象:LayoutAnimationController lac = new LayoutAnimationController(animation);

    3. 设置控件显示的顺序:lac.setOrder(LayoutAnimationController.ORDER_NORMAL);

    4. 为ListView设置LayoutAnimationController属性:listView.setLayoutAnimation(lac); 

  • 相关阅读:
    asp.net后台获取html控件的值
    asp.net自定义错误页面
    关于asp.net网站中web.config的配置
    在asp.net中如何使用Session
    Ubuntu 14.10 进入单用户模式
    原码,反码和补码
    利用位运算进行权限管理
    php redis扩展安装
    不同浏览器Cookie大小
    include和require的区别
  • 原文地址:https://www.cnblogs.com/lee0oo0/p/2513356.html
Copyright © 2020-2023  润新知