package mars.animation06;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import android.app.ListActivity;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.view.animation.LayoutAnimationController;
import android.widget.Button;
import android.widget.ListAdapter;
import android.widget.ListView;
import android.widget.SimpleAdapter;
public class MainActivity extends ListActivity {
private Button button = null;
private ListView listView = null;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
listView = getListView();
button = (Button)findViewById(R.id.buttonId);
button.setOnClickListener(new ButtonListener());
}
private ListAdapter buildListAdapter() {
List<HashMap<String, String>> list = new ArrayList<HashMap<String, String>>();
HashMap<String, String> m1 = new HashMap<String, String>();
m1.put("user_name", "平哥 斌哥");
m1.put("user_gender", "男");
HashMap<String, String> m2 = new HashMap<String, String>();
m2.put("user_name", "卓子 豆子");
m2.put("user_gender", "女");
HashMap<String, String> m3 = new HashMap<String, String>();
m3.put("user_name", "翔哥 小强");
m3.put("user_gender", "男");
list.add(m1);
list.add(m2);
list.add(m3);
SimpleAdapter simpleAdapter = new SimpleAdapter(this, list,
R.layout.item, new String[] { "user_name", "user_gender" },
new int[] { R.id.user_name, R.id.user_gender });
return simpleAdapter;
}
private class ButtonListener implements OnClickListener{
@Override
public void onClick(View v) {
listView.setAdapter(buildListAdapter());
Animation animation = (Animation)AnimationUtils.loadAnimation(MainActivity.this, R.anim.list_anim);
LayoutAnimationController lac = new LayoutAnimationController(animation);
lac.setOrder(LayoutAnimationController.ORDER_NORMAL);
lac.setDelay(0.5f);
listView.setLayoutAnimation(lac);
}
}
}
没有合适的资源?快使用搜索试试~ 我知道了~
Android——给控件添加动画
共42个文件
class:18个
png:8个
xml:6个
4星 · 超过85%的资源 需积分: 16 159 下载量 2 浏览量
2012-05-11
01:20:03
上传
评论 2
收藏 74KB RAR 举报
温馨提示
Android——给控件添加动画 为一个Layout里面的控件,或者右是一个ViewGroup里面的控件设置动画。
资源推荐
资源详情
资源评论
收起资源包目录
Android_控件添加动画.rar (42个子文件)
Android_控件添加动画
AndroidManifest.xml 682B
res
anim
list_anim_layout.xml 211B
list_anim.xml 302B
layout
item.xml 843B
main.xml 547B
drawable-ldpi
icon.png 2KB
drawable-mdpi
icon.png 3KB
drawable-hdpi
bt_page.png 3KB
icon.png 4KB
values
strings.xml 174B
proguard.cfg 1KB
src
mars
animation06
MainActivity.java 2KB
bin
classes
mars
animation06
MainActivity$ButtonListener.class 2KB
R.class 561B
MainActivity.class 3KB
R$anim.class 427B
R$layout.class 416B
R$attr.class 334B
R$id.class 448B
R$string.class 421B
R$drawable.class 425B
res
drawable-ldpi
icon.png 2KB
drawable-mdpi
icon.png 2KB
drawable-hdpi
bt_page.png 2KB
icon.png 4KB
classes.dex 5KB
resources.ap_ 15KB
16_animations06.apk 20KB
mars
animation06
MainActivity$ButtonListener.class 2KB
R.class 561B
MainActivity.class 3KB
R$anim.class 427B
R$layout.class 416B
R$attr.class 334B
R$id.class 448B
R$string.class 421B
R$drawable.class 394B
.classpath 288B
assets
project.properties 360B
.settings
org.eclipse.jdt.core.prefs 629B
.project 851B
gen
mars
animation06
R.java 1KB
共 42 条
- 1
huadou1125
- 粉丝: 4
- 资源: 7
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
- 1
- 2
- 3
- 4
前往页