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); 

  • 相关阅读:
    [导入]C#播放rm文件[转贴]
    新工具软件发布!名称:剪切板记录器
    黑發4/14
    sql20002 4/19
    頁面按百分比設定失調3/27
    廣告控件:AdRotator 3/23
    19992020小農曆JS 3/31
    ASP.NET1.1編譯錯誤代碼:1073741502 4/10
    SiteMapPath控件 3/24
    MYSQL時間問題4/16
  • 原文地址:https://www.cnblogs.com/lee0oo0/p/2513356.html
Copyright © 2011-2022 走看看