xml中: 代码如下: <ImageView &nb
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();
--结束END--
本文标题: android 简单图片动画播放的实例代码
本文链接: https://www.lsjlt.com/news/27560.html(转载时请注明来源链接)
有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341
下载Word文档到电脑,方便收藏和打印~
2024-01-21
2023-10-28
2023-10-28
2023-10-27
2023-10-27
2023-10-27
2023-10-27
回答
回答
回答
回答
回答
回答
回答
回答
回答
回答
0