zoukankan      html  css  js  c++  java
  • 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); 

  • 相关阅读:
    USACO 3.3 A Game
    USACO 3.3 Camelot
    USACO 3.3 Shopping Offers
    USACO 3.3 TEXT Eulerian Tour中的Cows on Parade一点理解
    USACO 3.3 Riding the Fences
    USACO 3.2 Magic Squares
    USACO 3.2 Stringsobits
    USACO 3.2 Factorials
    USACO 3.2 Contact
    USACO 3.1 Humble Numbers
  • 原文地址:https://www.cnblogs.com/lee0oo0/p/2513356.html
Copyright © 2011-2022 走看看