在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. STL之stack

    一.stack(栈) 栈:LIFO 后进先出: 首先要指出的是,stack并非和STL的其他类模板是独立的容器,stack是自适应容器(容器适配器) stack<int, deque<in ...

  2. 自定义ActionBar背景(分别针对3.0以下和3.0以上的版本)

    官方原文:http://developer.android.com/training/basics/actionbar/styling.html 针对3.0以上的版本: <?xml versio ...

  3. OC-多线程GCD的使用细节

    1>GCD,全称Grand Central Dispatch,”牛逼的中枢调度器”,纯C语言,提供了非常多强大的函数2>GCD优势:(1)GCD是苹果公司为多核的并行运算提出的解决方案(2 ...

  4. JVM 指令集合

    指令码 助记符 说明 0x00 nop 什么都不做 0x01 aconst_null 将null推送至栈顶 0x02 iconst_m1 将int型-1推送至栈顶 0x03 iconst_0 将int ...

  5. mvc中的几个数据传递

    1.ViewData对象 ViewBagData是一种字典集合数据同时属于视图基类和控制器基类的属性. 实例: //控制器 public class HomeController:Controller ...

  6. zk set 方法

    [root@wx03 zook]# cat a4.pl use ZooKeeper; use AnyEvent; use AE; use Data::Dumper; my $zk = ZooKeepe ...

  7. (step7.2.3)hdu 2554(N对数的排列问题——简单数论)

    题目大意:输入一个整数n,表示有n对整数.判断能否出现一种情况就是2个1之间有1个数,2个2之间有2个数..... 解题思路: 准备知识: ①n对数,共2*n个数.所以要有2*n个位置来放置这2*n个 ...

  8. 使用线程新建WPF窗体(公用进度条窗体)

    使用线程新建窗体 项目中需要一个公用的进度条窗体.大家知道在wpf中,有两个线程,一个是UI线程,另一个是监听线程(一直监听用户的输入).如果我们后台有阻塞UI线程的计算存在,那么界面上的比如进度条什 ...

  9. Codeforces Round #260 (Div. 2)C. Boredom(dp)

    C. Boredom time limit per test 1 second memory limit per test 256 megabytes input standard input out ...

  10. 【C语言】数字在排序数组中出现的次数(改动)

    //数字在排序数组中出现的次数(改动) //统计一个数字在排序数组中出现的次数.比如:排序数组{1,2,3,3,3.3,4,5}和数字3,因为3出现了4次,因此输出4. #include <st ...