<?xml version="1.0" encoding="UTF-8"?> <set xmlns:android="http://schemas.android.com/apk/res/android" android:interpolator="@android:anim/accelerate_interpolator"> <!-- 渐变透明的动画效果 --> <!--fromAlpha 动画起始透明的 1.0完全不透明 toAlpha 动画结束时透明的 0.0完全透明 startOffset 设置启动时间 duration 属性动画持续时间 --> <alpha android:fromAlpha="1.0" android:toAlpha="0.0" android:startOffset="500" android:duration="5000" /> </set>
<?xml version="1.0" encoding="UTF-8"?> <set xmlns:android="http://schemas.android.com/apk/res/android" android:interpolator="@android:anim/accelerate_interpolator"> <!-- 画面转移旋转动画效果 --> <!-- fromDegrees开始角度 toDegrees结束角度 pivotX设置旋转时的X轴坐标 --> <rotate android:fromDegrees="0" android:toDegrees="+360" android:pivotX="50%" android:pivotY="50%" android:duration="5000" /> </set>
<?xml version="1.0" encoding="UTF-8"?> <set xmlns:android="http://schemas.android.com/apk/res/android" android:interpolator="@android:anim/accelerate_interpolator"> <!-- 渐变尺寸伸缩动画效果 --> <!-- fromXScale 起始x轴坐标 toXScale 止x轴坐标 fromYScale 起始y轴坐标 toYScale 止y轴坐标 pivotX 设置旋转时的X轴坐标 pivotY 设置旋转时的Y轴坐标 duration 持续时间 --> <scale android:fromXScale="1.0" android:toXScale="0.0" android:fromYScale="1.0" android:toYScale="0.0" android:pivotX="50%" android:pivotY="50%" android:duration="5000" /> </set>
<?xml version="1.0" encoding="UTF-8"?> <set xmlns:android="http://schemas.android.com/apk/res/android" android:interpolator="@android:anim/accelerate_interpolator"> <!-- 画面转移位置移动动画效果 --> <translate android:fromXDelta="0%" android:toXDelta="100%" android:fromYDelta="0%" android:toYDelta="0%" android:duration="5000" /> </set>
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" > <ImageView android:id="@+id/image1" android:layout_width="match_parent" android:layout_height="200px" /> <ImageView android:id="@+id/image2" android:layout_width="match_parent" android:layout_height="200px" /> <ImageView android:id="@+id/image3" android:layout_width="match_parent" android:layout_height="200px" /> <ImageView android:id="@+id/image4" android:layout_width="match_parent" android:layout_height="200px" /> </LinearLayout>
public class AnimationDemo extends Activity{
private Animation animation,animation1,animation2,animation3;
private ImageView image1,image2,image3,image4;
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.animation);
initView();
}
public void initView()
{
animation=AnimationUtils.loadAnimation(AnimationDemo.this, R.anim.rotate);
animation1=AnimationUtils.loadAnimation(AnimationDemo.this, R.anim.scale);
animation2=AnimationUtils.loadAnimation(AnimationDemo.this, R.anim.alpha);
animation3=AnimationUtils.loadAnimation(AnimationDemo.this, R.anim.translate);
image1=(ImageView)findViewById(R.id.image1);
image1.setImageResource(R.drawable.jpeg);
image2=(ImageView)findViewById(R.id.image2);
image2.setImageResource(R.drawable.jpg);
image3=(ImageView)findViewById(R.id.image3);
image3.setImageResource(R.drawable.png);
image4=(ImageView)findViewById(R.id.image4);
image4.setImageResource(R.drawable.gif);
image1.startAnimation(animation);
image2.startAnimation(animation1);
image3.startAnimation(animation2);
image4.startAnimation(animation3);
}
}
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有