为listview,gridview添加布局动画效果(通过资源文件方式)
来源:互联网 发布:淘宝延长收货最多几天 编辑:程序博客网 时间:2024/06/05 04:50
private ArrayAdapter<String> adapter;
// private LayoutAnimationController lac;
// private ScaleAnimation sa;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
adapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, new String[]{"Hello","World","jikexueyuan"});
setListAdapter(adapter);
// sa = new ScaleAnimation(0, 1, 0, 1);
// sa.setDuration(1000);
// lac = new LayoutAnimationController(sa, 0.5f);
//
// getListView().setLayoutAnimation(lac);
}
}
布局文件代码:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<ListView
android:id="@android:id/list"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layoutAnimation="@anim/listview_anim" >
</ListView>
</LinearLayout>
listview_anim.xml文件代码:
<?xml version="1.0" encoding="utf-8"?>
<layoutAnimation xmlns:android="http://schemas.android.com/apk/res/android"
android:animation="@anim/scale_0_1"
android:delay="0.5" >
</layoutAnimation>
scale_0_1.xml文件代码:
<?xml version="1.0" encoding="utf-8"?>
<scale xmlns:android="http://schemas.android.com/apk/res/android"
android:fromXScale="0"
android:toXScale="1"
android:fromYScale="0"
android:toYScale="1"
android:duration="1000" />
- 为listview,gridview添加布局动画效果(通过资源文件方式)
- 为GridView添加动画效果
- Android Animation 为布局添加动画效果
- AndroidUI 布局动画-为列表添加布局动画效果
- android之动画(二)通过动画布局声明文件和关联文件为容器布局----布局动画
- android之动画通过动画布局声明文件和关联文件为容器布局----布局动画
- android动画 通过动画布局声明文件和关联文件为容器布局----布局动画
- Android为listview的item添加动画效果
- 为GridView添加头布局
- 给ListView添加动画效果
- 为GridView添加边框效果
- AndroidUI 布局动画-为布局添加动画
- 给listview或gridview设置动画效果
- ListView或GridView添加加载列表动画
- 为ListView添加Ripple效果
- 机顶盒 gridview 焦点位置效果动画添加
- listview中 对adapter添加动画效果
- 动态添加布局增添动画过渡效果
- Windows系统中如何配置Apache的SSL加密访问
- 软件测试中的V模型、W模型和H模型
- 简易版的随机地图方法,适合少数场景
- RelativeLayout重要属性
- 定义变量的位置 @interface VS @implementation
- 为listview,gridview添加布局动画效果(通过资源文件方式)
- STL之容器、迭代器及算法知识总结
- 合并两个已排序的链表
- linux 下搭建从coturn服务器(穿透服务器)
- 大数相加
- PHP扩展开发-接收参数、返回参数
- typedef与#define的区别
- Contains Duplicate III 是否包含重复元素系列3
- Bitcode真机测试要修改为 NO