源码网商城,靠谱的源码在线交易网站 我的订单 购物车 帮助

源码网商城

android 简单图片动画播放的实例代码

  • 时间:2022-06-23 13:19 编辑: 来源: 阅读:
  • 扫一扫,手机访问
摘要:android 简单图片动画播放的实例代码
xml中:
[u]复制代码[/u] 代码如下:
        <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中:
[u]复制代码[/u] 代码如下:
               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();
  • 全部评论(0)
联系客服
客服电话:
400-000-3129
微信版

扫一扫进微信版
返回顶部