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拜读了高手的代码,自愧弗如,比我不知道高到哪里去了…… ...
随机推荐
- C++之路起航——标准模板库(queue)
queue: FIFO队列:先进先出队列. 优先队列:对队列中的元素按优先级的大小输出. 定义: FIFO队列: queue<数据类性>变量名. 优先队列:priority_queue&l ...
- shell 命令
- 表单和验证事件以及marquee标签
1.表单验证<form></form> (1).非空验证(去空格) (2).对比验证(跟一个值对比) (3).范围验证(根据一个范围进行判断) (4).固定格式验证:电话号码, ...
- js获取单选框radio的值
遇到一个js获取radio值的问题,原来根据frm.type.value取到的值在ie下是空值 解决办法:type为每个radio的值 var chkObjs=document.getElements ...
- Qt源码包中的一段代码
之所以单独拣出来是因为Qt的开发者们给普通开发者提供了高效编程的商业代码例子: bool QWidget::testAttribute_helper(Qt::WidgetAttribute attri ...
- Java笔试题解答和部分面试题
面试类 银行类的问题 问题一:在多线程环境中使用HashMap会有什么问题?在什么情况下使用get()方法会产生无限循环? HashMap本身没有什么问题,有没有问题取决于你是如何使用它的.比如,你 ...
- 使用node-webkit开发exe窗口程序
首发:个人博客,更新&纠错&回复 ====关于原生程序与壳中程序的议论begin==== 在所有用户windows机器上都能直接跑的程序,如果不采用微软系的语言,如VB,C++,C#等 ...
- SDK Manager failed to install 'java.exe' locking directory
转自:http://stackoverflow.com/questions/13587478/sdk-manager-failed-to-install-java-exe-locking-direct ...
- android 开发工具(android studio)
Android Studio 从安装到配置使用 okhttp比xutils功能强大,源码地址: https://github.com/search?utf8=✓&q=okhttp andr ...
- java的web项目中使用cookie保存用户登陆信息
本文转自:http://lever0066.iteye.com/blog/1735963 最近在编写论坛系统的实现,其中就涉及到用户登陆后保持会话直到浏览器关闭,同时可以使用cookie保存登陆信息以 ...