您的位置:首页 > 移动开发 > Android开发

android 简单图片动画播放实现

2012-11-27 16:36 585 查看
xml中:

<ImageView

android:id="@+id/touchview"

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:layout_alignParentLeft="true"

android:layout_centerVertical="true"

android:src="@drawable/touch" />

java中:

mTouchView = (ImageView) findViewById(R.id.touchview);

AlphaAnimation mAlphaAnimation = new AlphaAnimation(0.1f, 1.0f); ////创建一个AlphaAnimation对象,参数从透明到不透明

mAlphaAnimation.setDuration(1000);// 设定动画时间

mAlphaAnimation.setRepeatCount(Animation.INFINITE);//定义动画重复时间

mAlphaAnimation.setRepeatMode(Animation.REVERSE);//通过设置重复时间定义动画的行为

mTouchView.setAnimation(mAlphaAnimation);

mAlphaAnimation.start();
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: