- 浏览: 46514 次
- 性别:
- 来自: 西安
最新评论
Scale animation: You use this type of animation to make a view smaller
or larger either on the x axis or on the y axis. You can also specify the
pivot point around which you want the animation to take place.
下面我们将要实现一个scale Animation的小列子
1)在anim文件夹下用xml定义一个scale Animation
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:interpolator="@android:anim/accelerate_interpolator">
<scale
android:fromXScale="1"
android:toXScale="1"
android:fromYScale="0.1"
android:toYScale="1.0"
android:duration="500"
android:pivotX="50%"
android:pivotY="50%"
android:startOffset="100" />
</set>
2)define the main.xml 其中listView 中的每一个item将会按照scale Animation中
定义好的方式展示出来
<?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">
<ListView android:id="@+id/list_view_id"
android:persistentDrawingCache="animation|scrolling"
android:layout_width="fill_parent" android:layout_height="fill_parent"
android:layoutAnimation="@anim/list_layout_controller" />
/>
</LinearLayout>
注意到这里有一个android:layoutAnimation 属性
the ListView requires another XML file that acts as a mediator between itself and the animation set.
the mediator 就是上面的list_layout_controller, 用xml文件中实现, 下面是实现的代码
<layoutAnimation xmlns:android="http://schemas.android.com/apk/res/android"
android:delay="30%"
android:animationOrder="reverse"
android:animation="@anim/scale" />
这样一来就可以将listview中的item按照定义好的scale Animation展示
出来了
这是Activity的代码
package hust.ophoneclub.ScaleAnimation;
import android.app.Activity;
import android.os.Bundle;
import android.widget.ArrayAdapter;
import android.widget.ListView;
public class ScaleAnimation extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
setupLiatView();
}
/**
*
*/
private void setupLiatView() {
String[] listItems = new String[]{
"Item1", "Item2", "Item3",
"Item4", "Item5", "Item6"
};
ArrayAdapter listItemAdapter =
new ArrayAdapter(this, android.R.layout.simple_list_item_1,
listItems);
ListView listView = (ListView)findViewById(R.id.list_view_id);
listView.setAdapter(listItemAdapter);
}
}
效果是每个item中的文字会沿着y轴扩展开来
发表评论
-
Android Intent and Intent Filter (转)
2011-03-10 22:47 1428Android Intent and Intent ... -
Intent详解
2011-03-03 14:18 1116在应用中,我们可以以两种形式来使用Intent: 直接I ... -
Intent间传送数据一般有两种常用方法
2011-01-24 14:50 1269Intent间传送数据一般有两种常用的办法: 1.extra ... -
android RelativeLayout 详解
2011-01-01 09:46 1561<?xml version="1.0" ... -
How to Use Android Downloads Provider
2010-12-20 21:41 1307本文转载自 http://blog.lytsing.or ... -
android 开发中的一些小知识点
2010-12-17 09:49 9641 关于onPause(): onPause ... -
content provider 深入解析
2010-12-15 22:04 1067Content providers are on ... -
Service的高级应用
2010-12-12 20:48 1323下面是android Service的高级应用的一个例子,主要 ... -
TabActivity
2010-12-12 19:09 1733下面是一个使用android tabactivity 的例子 ... -
android 测试初探(android test)
2010-12-07 15:00 7986android Testing and Instrumenta ... -
Localization of android
2010-12-05 21:51 0android 会在不同地域的不同机器上运行。为了是应用能够 ... -
android高效编程之使用本地变量
2010-12-05 14:26 948hava a look at the following co ... -
在不同的Activity中传递对象的方法
2010-12-02 10:20 1981下面我们将要实现的功 ... -
Cursor与Adapter
2010-11-21 08:34 1203来自: http://hi.baidu.com/lfcaoli ... -
Working with Context Menus
2010-11-15 23:36 828... -
Handler的理解
2010-11-14 20:58 801A Handler allows you to sen ... -
android开发问题解决日志
2010-11-14 18:33 18461.、android中R文件消失的处理方式 ... -
android 中对SDCard 的操作
2010-11-11 14:14 1600对于像视频这样的大文件,我们可以把它存放在SDCard。 SD ... -
ViewAnimation
2010-11-05 12:46 1012view animation 的实现 Understandi ... -
android高效的编写高效代码
2010-10-17 19:13 729本文来源于: 从此学习网 原文: http://www.con ...
相关推荐
超漂亮的 Animation Scale 动画设置效果。.zip,快速设置平铺以快速设置动画持续时间比例。
Simple custom ViewGroup with two shapes inside and simple scale animation View Download For project API 21 . Gradle compile 'com.steelkiwi:separate-shapes-view:1.1.0' Usage First of all, need add ...
• 1、《Animation 动画详解(一)——alpha、scale、translate、rotate、set的xml属性及用法》 • 2、《Animation动画详解(二)——Interpolator插值器》 • 3、《Animation动画详解(三)—— 代码生成alpha、...
Animation 动画详解(一)——alpha、scale、translate、rotate、set的xml属性及用法
A RatingBar with progressive and scale animation. RotationRatingBar (contributed by nappannda) A RatingBar with progressive and rotate animation. Demo Icon made by Freepik from www.flaticon.com ...
博客<Animation动画详解(三)—— 代码生成alpha、scale、translate、rotate、set及插值器动画>对应源码,博客地址:http://blog.csdn.net/harvic880925/article/details/40117115
参考 Android动画学习Demo(1) 关于ViewAnimation的用法及总结
- Move, rotate, scale almost anything - Execute animations in parallel - Comes with 31 easing effects - Animating objects on a set of way points - Animate custom components - Animate custom fields/...
博客《Animation 动画详解(一)——alpha、scale、translate、rotate、set的xml属性及用法》对应源码,博客地址:http://blog.csdn.net/harvic880925/article/details/39996643
meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0"> <style> body{ background-color: lightblue; overflow:hidden; ...
Tweened animation有四种类型,下面主要介绍Scale类型。 运行效果如下: Android SDK提供了2种方法:直接从XML资源中读取Animation,使用Animation子类的构造函数来初始化Animation对象,第二种方法在看了Android ...
方法UIAnimation class func moveTo(point : CGPoint, duration : NSTimeInterval) -> UIAnimation class func moveBy(point : CGPoint, duration : NSTimeInterval) -> UIAnimation class func scaleTo(scale : ...
参考 View Animation 效果
我找不到适合我需要的npm软件包: 动画任何DOM属性的能力使用进行表演暂时挂起以最大程度地减少负载没有data-属性或特殊标签正在安装npm install scroll-animation用法const animate = require ( 'scroll-animation...
补间动画:渐变动画支持四种类型:平移(Translate)、旋转(Rotate)、缩放(Scale)、不透明度(Alpha);只是显示的位置变动,View的实际位置未改变,表现为View移动到其他地方,点击事件仍在原处才能响应;组合...
Android动画例子(AnimationExample),写了四种效果 alpha 渐变透明度动画效果 scale 渐变尺寸伸缩动画效果 translate 画面转换位置移动动画效果 rotate 画面转移旋转动画效果 文章:...
用同样的方式在anim文件夹右键选择Animation Resource File创建xml文件,再打开的对话框中录入File name录入scale_animation。;补间动画;采用同样的方式在anim文件夹右键选择Animation Resource File创建xml文件,再...
在CSS3中我们可以使用animation属性来创建复杂的动画效果,包括移动,旋转,缩放,倾斜(后几个请参考css3中的transform,scale等属性)等。而这一切,只需要我们创建关键帧(@keyframes),然后将自己想要实现的...
本文实例讲述了Android编程之Animation动画用法。分享给大家供大家参考,具体如下: Animations 一、Animations介绍 Animations是一个实现android UI界面动画效果的API,Animations提供了一系列的动画效果,可以进行...
微信小程序-今日头条案例 项目为仿今日头条,使用了百度ApiStore接口查询数据,使用微信... animation.scale(2).rotate(360).step(); animation.scale(1).step(); this.setData({ animationData : animation.export()