在res/anim下新建anim_set.xml:

<?xml version="1.0" encoding="utf-8"?>

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

<alpha

android:fromAlpha="1.0"

android:toAlpha="0.0"

android:duration="3000" />

<scale

android:fromXScale="1.0"

android:toXScale="0.0"

android:fromYScale="1.0"

android:toYScale="0.0"

android:pivotX="50%"

android:pivotY="50%"

android:startOffset="100"

android:repeatCount="3"

android:duration="3000" />

</set>

在main.xml中:

<?xml version="1.0" encoding="utf-8"?>

<LinearLayout

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

android:orientation="vertical"

android:layout_width="fill_parent"

android:layout_height="fill_parent"

android:background="#3399ff">

<ListView

android:id="@+id/myListView"

android:layout_marginLeft="8dp"

android:background="#3399ff"

android:layout_gravity="center_vertical"

android:layout_width="fill_parent"

android:layout_height="wrap_content"/>

</LinearLayout>

在布局文件info.xml中:

<?xml version="1.0" encoding="utf-8"?>

<TableLayout

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

android:orientation="vertical"

android:layout_width="fill_parent"

android:layout_height="fill_parent"

android:background="#3399ff">

<TableRow >

<TextView

android:id="@+id/id"

android:layout_marginLeft="8dp"

android:layout_width="100dp"

android:layout_height="30dp"/>

<TextView

android:id="@+id/title"

android:layout_width="200dp"

android:layout_height="30dp"/>

</TableRow>

</TableLayout>

在MyAnimationDemo.java中:

package com.li.animation;

import java.util.ArrayList;

import java.util.HashMap;

import java.util.List;

import java.util.Map;

import android.app.Activity;

import android.os.Bundle;

import android.view.animation.Animation;

import android.view.animation.AnimationUtils;

import android.view.animation.LayoutAnimationController;

import android.widget.GridView;

import android.widget.ListView;

import android.widget.SimpleAdapter;

public class MyAnimationDemo extends Activity {

private ListView myListView = null;

private String idData[] = new String[]{"java","android","c","c++"};

private String tileData[] = new String[]{"中国","广 西","北 海","李叶文"};

private SimpleAdapter simple = null;

@Override

public void onCreate(Bundle savedInstanceState) {

super.onCreate(savedInstanceState);

super.setContentView(R.layout.main);

this.myListView = (ListView) super.findViewById(R.id.myListView) ;

List<Map<String,Object>> all = new ArrayList<Map<String,Object>>();

Map<String,Object> map = null;

for(int x = 0; x < this.idData.length; x++){

map = new HashMap<String, Object>();

map.put("id",this.idData[x]);

map.put("title",this.tileData[x]);

all.add(map);

}

this.simple = new SimpleAdapter(this,all,R.layout.info,new String[]{

"id","data"},new int[]{R.id.id,R.id.title});

this.myListView.setAdapter(this.simple);

Animation anim = AnimationUtils.loadAnimation(this,R.anim.anim_set);

LayoutAnimationController control = new LayoutAnimationController(anim);

control.setDelay(0.5f);

control.setOrder(LayoutAnimationController.ORDER_RANDOM);

this.myListView.setLayoutAnimation(control);

}

}

程序实现LayoutAnimationController的更多相关文章

  1. Android应用程序窗口(Activity)的测量(Measure)、布局(Layout)和绘制(Draw)过程分析

    文章转载至CSDN社区罗升阳的安卓之旅,原文地址:http://blog.csdn.net/luoshengyang/article/details/8372924 在前面一篇文章中,我们分析了And ...

  2. android.view.animation(3) - LayoutAnimationController 和 GridLayoutAnimationController

    前几篇给大家讲述了如何针对某一个控件应用动画,这篇将给大家讲解如何给容器中的控件应用统一动画.即在容器中控件出现时,不必为每个控件添加进入动画,可以在容器中为其添加统一的进入和退出动画. 从上面的示例 ...

  3. JavaScript之父Brendan Eich,Clojure 创建者Rich Hickey,Python创建者Van Rossum等编程大牛对程序员的职业建议

    软件开发是现时很火的职业.据美国劳动局发布的一项统计数据显示,从2014年至2024年,美国就业市场对开发人员的需求量将增长17%,而这个增长率比起所有职业的平均需求量高出了7%.很多人年轻人会选择编 ...

  4. 【小程序分享篇 一 】开发了个JAVA小程序, 用于清除内存卡或者U盘里的垃圾文件非常有用

    有一种场景, 手机内存卡空间被用光了,但又不知道哪个文件占用了太大,一个个文件夹去找又太麻烦,所以我开发了个小程序把手机所有文件(包括路径下所有层次子文件夹下的文件)进行一个排序,这样你就可以找出哪个 ...

  5. 微信小程序开发心得

    微信小程序也已出来有一段时间了,最近写了几款微信小程序项目,今天来说说感受. 首先开发一款微信小程序,最主要的就是针对于公司来运营的,因为,在申请appid(微信小程序ID号)时候,需要填写相关的公司 ...

  6. node.js学习(三)简单的node程序&&模块简单使用&&commonJS规范&&深入理解模块原理

    一.一个简单的node程序 1.新建一个txt文件 2.修改后缀 修改之后会弹出这个,点击"是" 3.运行test.js 源文件 使用node.js运行之后的. 如果该路径下没有该 ...

  7. 微信应用号(小程序)开发IDE配置(第一篇)

    2016年9月22日凌晨,微信宣布“小程序”问世,当然只是开始内测了,微信公众平台对200个服务号发送了小程序内测邀请.那么什么是“小程序”呢,来看微信之父怎么说 看完之后,相信大家大概都有些明白了吧 ...

  8. 编写高质量代码:改善Java程序的151个建议(第5章:数组和集合___建议75~78)

    建议75:集合中的元素必须做到compareTo和equals同步 实现了Comparable接口的元素就可以排序,compareTo方法是Comparable接口要求必须实现的,它与equals方法 ...

  9. 【探索】在 JavaScript 中使用 C 程序

    JavaScript 是个灵活的脚本语言,能方便的处理业务逻辑.当需要传输通信时,我们大多选择 JSON 或 XML 格式. 但在数据长度非常苛刻的情况下,文本协议的效率就非常低了,这时不得不使用二进 ...

随机推荐

  1. CodeForces 508C Anya and Ghosts 贪心

    做不出题目,只能怪自己不认真 题目: Click here 题意: 给你3个数m,t,r分别表示鬼的数量,每只蜡烛持续燃烧的时间,每个鬼来时要至少亮着的蜡烛数量,接下来m个数分别表示每个鬼来的时间点( ...

  2. __get __set 实例

    <?php class Person { //下面是人的成员属性,都是封装的私有成员 private $name; //人的名子 private $sex; //人的性别 private $ag ...

  3. media_root以及static_root配置

    # At the top of settings/base.pyfrom os.path import join, abspath, dirnamehere = lambda *x: join(abs ...

  4. JProtector 帮助文档

    一.应用加密 1.使用 JProtector在线 进行应用加密:使用浏览器访问 http://app.shuton.net/encryptjar, 点击 Browse 选择待加密的应用jar包.war ...

  5. php前端控制器2

    Front Controllers act like centralized agents in an application whose primary area of concern is to ...

  6. 转:Javascript继承机制的设计思想

    我一直很难理解Javascript语言的继承机制. 它没有"子类"和"父类"的概念,也没有"类"(class)和"实例" ...

  7. 查看linux下各数据类型的大小

    代码如下: #include<stdio.h> int main() { printf("int:%d bytes\n",sizeof(int)); printf(&q ...

  8. DH11数字温湿度传感器

    DH11数字温湿度传感器是一种集温度.湿度一体的复合传感器,它能把温度和湿度物理量通过温.湿度敏感元件和相应电路转化成方便计算机.PLC.智能仪表等数据采集设备直接读取的数字量.DHT11由电阻式感湿 ...

  9. JSP两个动作(include,forward)

    include动作 <div id="container"> <jsp:include page="HelloWorld.jsp" flush ...

  10. ELK 之一:ElasticSearch 基础和集群搭建

    一:需求及基础: 场景: 1.开发人员不能登录线上服务器查看详细日志 2.各个系统都有日志,日志数据分散难以查找 3.日志数据量大,查询速度慢,或者数据不够实时 4.一个调用会涉及到多个系统,难以在这 ...