在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. Python 中的list小结

    list的下标和子list list的下表从零开始,和C语言挺类似的,但是增加了负下标的使用. -len-----第一个元素 ......       ...... -2 ------ 倒数第二个元素 ...

  2. MFC下的日历表

    // CalenderDlg.h : header file // #if !defined(AFX_CALENDERDLG_H__8DC8F113_2A47_45B8_8266_75CB406D68 ...

  3. iOS开发之理解iOS中的MVC设计模式

    模型-视图-控制器(Model-View-Controller,MVC)是Xerox PARC在20世纪80年代为编程语言Smalltalk-80发明的一种软件设计模式,至今已广泛应用于用户交互应用程 ...

  4. 百度SiteApp构建网站APP

    现在很多个人网站和企业网站都是传统的Web方式,有没有想过个人/企业网站也能做成APP应用对外宣传呢?专门找人去开发Android和IOS上的APP又太贵,为了赶上移动互联网时髦,我以个人网站试做了一 ...

  5. 仿爱乐透android客户端界面实现(附工程源码)

    最近研究了爱乐透android客户端的界面,感觉它的界面布局在一般开发中具有代表性.难点在于复杂的布局实现. 界面实现主要采用了以下方式: 注意:版本支持:android2.2以上,低版本要改动源码哦 ...

  6. Net::OpenSSH 使用例子

    [root@dr-mysql01 mojo]# cat a1.pl use Net::OpenSSH; my $host = '121.4xx.xx1.41'; my $user = 'root'; ...

  7. java--进步学习IO

    import java.io.*; public class Demo1 { public static void main(String []args) throws Exception{ File ...

  8. android之View的启动过程

    转自:http://www.cdtarena.com/gpx/201308/9607.html 程序里调用了onSizeChanged方法进行了一些设置,不知道onSizeChanged是在什么时候启 ...

  9. char s[]字串和char *s字串有什麼区别?

    C語言有兩種字串宣告方式char s[]和char *s,兩者有什麼差異呢? Introduction char s[] = "Hello World"; (只是用字符串常量初始化 ...

  10. 在程序中,你敢怎样使用“goto”语句!

    用goto是一个个人爱好的问题.“我”的意见是,十个goto中有九个可以用相应的结构化结构来替换.在那些简单情形下,你可以完全替换掉goto,在复杂的情况下,十个中也有九个可以不用:你可以把部分代码写 ...