ListView Animation
简单介绍一下4种动画效果方式 AnimationSet set = new AnimationSet(false);
Animation animation = new AlphaAnimation(0,1); //AlphaAnimation 控制渐变透明的动画效果
animation.setDuration(500); //动画时间毫秒数
set.addAnimation(animation); //加入动画集合 animation = new TranslateAnimation(1, 13, 10, 50); //ScaleAnimation 控制尺寸伸缩的动画效果
animation.setDuration(300);
set.addAnimation(animation); animation = new RotateAnimation(30,10); //TranslateAnimation 控制画面平移的动画效果
animation.setDuration(300);
set.addAnimation(animation); animation = new ScaleAnimation(5,0,2,0); //RotateAnimation 控制画面角度变化的动画效果
animation.setDuration(300);
set.addAnimation(animation); LayoutAnimationController controller = new LayoutAnimationController(set, 1); GridView gridView = (GridView) this.findViewById(R.id.gridview);
gridView .setLayoutAnimation(controller); //GridView 设置动画效果 ListView listview= (ListView)this.findViewById(R.id.listview);
listview.setLayoutAnimation(controller); //ListView 设置动画效果
nim文件夹下建立anim_layout.xml和alpha.xml
android:animationOrder 的取值有normal 0 默认reverse 1 倒序random 2 随机
anim_layout.xml
<?xml version="1.0" encoding="utf-8"?>
<layoutAnimation xmlns:android="http://schemas.android.com/apk/res/android"
android:delay="0.5"
android:animationOrder="random"
android:animation="@anim/alpha"
/>
alpha.xml
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:interpolator="@android:anim/accelerate_interpolator">
<alpha
android:fromAlpha="0.0"
android:toAlpha="1.0"
android:duration="500" />
</set>
布局文件里的ListView增加一个layoutAnimation属性
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" > <ListView
android:id="@id/android:list"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:drawSelectorOnTop="false"
android:layoutAnimation="@anim/anim_layout"
></ListView> <TextView
android:id="@id/android:empty"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:text="No data" /> </LinearLayout>
ListView Animation的更多相关文章
- ListCell Animation in ListView
After a long time I am back again with new stuffs. I have seen that JavaFX has got so many demand no ...
- 自己定义控件三部曲之动画篇(十三)——实现ListView Item进入动画
前言:宝剑锋从磨砺出,梅花香自苦寒来 相关文章: <Android自己定义控件三部曲文章索引>: http://blog.csdn.net/harvic880925/article/det ...
- # Android动画笔记
标签: Android开发艺术探索笔记 View动画 帧动画 属性动画 View动画 View动画的作用对象时View,有4种动画效果,分别是平移动画.缩放动画.旋转动画.和透明度动画. 此类动画通常 ...
- ListView的淡入淡出和Activity的淡入淡出补间动画效果Animation
//=========主页面======================= package com.bw.lianxi7; import android.os.Bundle;import androi ...
- Animation显示ListView的每一条记录
activity_main.xml <?xml version="1.0" encoding="utf-8"?> <LinearLayout ...
- Android Animation动画实战(一): 从布局动画引入ListView滑动时,每一Item项的显示动画
前言: 之前,我已经写了两篇博文,给大家介绍了Android的基础动画是如何实现的,如果还不清楚的,可以点击查看:Android Animation动画详解(一): 补间动画 及 Android An ...
- listview下拉刷新和上拉加载更多的多种实现方案
listview经常结合下来刷新和上拉加载更多使用,本文总结了三种常用到的方案分别作出说明. 方案一:添加头布局和脚布局 android系统为listview提供了addfootview ...
- 浅谈ListView滑动隐藏显示ToolBar
引言 在App日益追求体验的时代,优秀的用户体验往往会使产品脱颖而出.今天我们就来介绍一种简单的滑动ListView来显示或者隐藏ToolBar的功能. 布局文件 下面我们来看一下这个主界面的布局文件 ...
- UWP开发入门(二十二)——Storyboard和Animation
微博上有同学问我MyerSplash是如何实现那个很炫的图片点亮,然后移动到屏幕中央的效果.惭愧啊,我又不是作者哪里会知道.硬着头皮去GitHub拜读了高手的代码,自愧弗如,比我不知道高到哪里去了…… ...
随机推荐
- table创建固定表头
布局:两个div,上部内容将表头复制,高度固定,下部div内部将table设置为margin:-**px; 隐藏掉表头,下部div设置overflow,即可. 代码:
- CentOS 7 自动更新时间日期
# ntpdate time.nist.gov 或 # rdate -s time.nist.gov 下列服务器可用 time-nw.nist.gov
- [转]mongodb 查询条件:关系运算符"$lt", "$lte", "$gt", "$gte", "$ne" 逻辑运算符"$and“, "$or“, "$nor“
mongodb 查询条件 这节来说说mongodb条件操作符,"$lt", "$lte", "$gt", "$gte" ...
- wamp多站点配置
1.修改wamp安装目录下:\wamp\bin\apache\Apache2.2.21\conf\extra中的httpd-vhosts.conf文件如下: 2.修改wamp-apache-httpd ...
- maven的中传递依赖,maven的依赖管理(转)
在maven的pom文件中 <dependencies> <dependency> <groupId>junit</groupId> <artif ...
- JDBC工作模块
jdbc-->java数据库连接 的简称 JDBC工作模块 加载jdbc驱动 与数据库连接 发送sql语句,得到返回结果 处理返回结果 释放资源
- BZOJ1930 [Shoi2003]pacman 吃豆豆
dp,首先建出图,f[i][j]表示a吃到了i点,b吃到了j点的最大值,转移的时候转移拓扑序小的那一维,如果i拓扑序小于j,那么转移到f[k][j],否则转移到f[i][k],建出的图边数也要优化, ...
- zw版【转发·台湾nvp系列Delphi例程】HALCON ObjToInteger1-4
zw版[转发·台湾nvp系列Delphi例程]HALCON ObjToInteger1 procedure TForm1.Button1Click(Sender: TObject);var img, ...
- Yii增删改查操作
增: 1 第一种 $post=new Post; $post->title='sample post'; $post->content='content for the sample po ...
- linux 文件删除原理
文件删除: i_link 文件的硬连接数 i_count 引用计数(有一个程序使用i_count加1) 文件删除的条件: i_link=0 and i_count=0 被进程占用的文件可以删除