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();
<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();
相关文章推荐
- Android利用Drawable Animation实现图片动画播放
- android,侧滑栏SlidingLayout、ViewPager实现画廊、简单用viewpager实现画廊、圆形图片、简单的跑马灯动画效果、可拖拽的弹簧式水泡动画集合
- Android用两张图片实现简单动画效果
- android 简单图片动画播放的实例代码
- Android Graphics 学习(1)----播放gif动画简单的实现
- Android属性动画简单实现图片的伸缩
- Android属性动画简单实现图片的伸缩
- 实现android gif图片动画播放功能
- Android Tween动画之RotateAnimation实现图片不停旋转
- Android成长之路-实现简单动画
- Android Tween动画之RotateAnimation实现图片不停旋转
- Android PowerImageView实现,可以播放动画的强大ImageView
- Android无限循环与自动播放ViewPager的简单实现(广告栏)
- Java之简单的图片动态显示(实现类似GIF动画结果)
- android怎样播放多张图片形成一个动画
- Android的AnimationSet动画实现图片的轮播,移动和切换可以自定义时间
- Android之——史上最简单图片轮播广告效果实现
- Android RenderScript 简单高效实现图片的高斯模糊效果
- 实现Android播放声音资源的一个简单的工具类
- android 循环播放图片实现