程序实现LayoutAnimationController
在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的更多相关文章
- Android应用程序窗口(Activity)的测量(Measure)、布局(Layout)和绘制(Draw)过程分析
文章转载至CSDN社区罗升阳的安卓之旅,原文地址:http://blog.csdn.net/luoshengyang/article/details/8372924 在前面一篇文章中,我们分析了And ...
- android.view.animation(3) - LayoutAnimationController 和 GridLayoutAnimationController
前几篇给大家讲述了如何针对某一个控件应用动画,这篇将给大家讲解如何给容器中的控件应用统一动画.即在容器中控件出现时,不必为每个控件添加进入动画,可以在容器中为其添加统一的进入和退出动画. 从上面的示例 ...
- JavaScript之父Brendan Eich,Clojure 创建者Rich Hickey,Python创建者Van Rossum等编程大牛对程序员的职业建议
软件开发是现时很火的职业.据美国劳动局发布的一项统计数据显示,从2014年至2024年,美国就业市场对开发人员的需求量将增长17%,而这个增长率比起所有职业的平均需求量高出了7%.很多人年轻人会选择编 ...
- 【小程序分享篇 一 】开发了个JAVA小程序, 用于清除内存卡或者U盘里的垃圾文件非常有用
有一种场景, 手机内存卡空间被用光了,但又不知道哪个文件占用了太大,一个个文件夹去找又太麻烦,所以我开发了个小程序把手机所有文件(包括路径下所有层次子文件夹下的文件)进行一个排序,这样你就可以找出哪个 ...
- 微信小程序开发心得
微信小程序也已出来有一段时间了,最近写了几款微信小程序项目,今天来说说感受. 首先开发一款微信小程序,最主要的就是针对于公司来运营的,因为,在申请appid(微信小程序ID号)时候,需要填写相关的公司 ...
- node.js学习(三)简单的node程序&&模块简单使用&&commonJS规范&&深入理解模块原理
一.一个简单的node程序 1.新建一个txt文件 2.修改后缀 修改之后会弹出这个,点击"是" 3.运行test.js 源文件 使用node.js运行之后的. 如果该路径下没有该 ...
- 微信应用号(小程序)开发IDE配置(第一篇)
2016年9月22日凌晨,微信宣布“小程序”问世,当然只是开始内测了,微信公众平台对200个服务号发送了小程序内测邀请.那么什么是“小程序”呢,来看微信之父怎么说 看完之后,相信大家大概都有些明白了吧 ...
- 编写高质量代码:改善Java程序的151个建议(第5章:数组和集合___建议75~78)
建议75:集合中的元素必须做到compareTo和equals同步 实现了Comparable接口的元素就可以排序,compareTo方法是Comparable接口要求必须实现的,它与equals方法 ...
- 【探索】在 JavaScript 中使用 C 程序
JavaScript 是个灵活的脚本语言,能方便的处理业务逻辑.当需要传输通信时,我们大多选择 JSON 或 XML 格式. 但在数据长度非常苛刻的情况下,文本协议的效率就非常低了,这时不得不使用二进 ...
随机推荐
- Axure滚动效果实现
下面的这个透明区域用于显示滚动效果,它本身是一个处于隐藏状态的动态面板,它里面也放了一个动态面板用于产生移动的效果 里面的动态面板起名“实际内容”,注意它的默认状态是“状态2”,状态2和状态一的内容一 ...
- Python 模块续和面向对象的介绍(六)
一.基本模块 shutil 文件.目录.压缩包的处理模块 shutil.copyfile(src, dst) 拷贝文件 >>> shutil.copyfile('a.log','b. ...
- QML在XP等显卡明显不好的情况下 可以参考
http://doc.qt.io/qt-5/windows-requirements.html
- OpenBlas编译方法(体验msys下使用MingW)
OpenBlas是一个优化的Blas库,基于GotoBlas21.13 BSD版,安装步骤如下: Windows下安装: 1. 在SourgeForge下载最新的OpenBlas库:http://so ...
- 关于DataGridViewComboBoxCell修改后提交数据源
最近在项目遇到一个功能实现.是在DataGridView中DataGridViewComboboxColumn列绑定数据源, DisplayMember为数据表的Name列,ValueMember是数 ...
- 安卓开发-Activity中finish() onDestroy() 和System.exit()的区别
Activity.finish()Call this when your activity is done and should be closed. 在你的activity动作完成的时候,或者Act ...
- SimpleAdapter
1.视图 1)主视图 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" x ...
- WebView使用详解
一.用WebView处理页面导航 可以加载本地资源也可以加载web资源,区别是我们要加载本地资源要实现在assets文件夹里添加一个.html资源.调取网页的时候可以用loadUrl方法把网址添加进去 ...
- 基于Qt的FreeType字体轮廓解析
一.本文目的 以前的文档中.详细的介绍了FreeType开源字体引擎库的基础知识.基本用法.但并未详细的阐明在TurboCG中.是如何解析出一个文字的轮廓的,本文集中阐述.怎么样使用FreeType开 ...
- 华为OJ:计算两个自然时间相加
按要求一步步做就好 import java.util.Scanner; public class dateAdd { public static void main(String args[]){ S ...