Tween 补间动画
来源:互联网 发布:淘宝假单号哪里买 编辑:程序博客网 时间:2024/05/24 08:33
在res/anim中
alpha_anim.xml
<set xmlns:android="http://schemas.android.com/apk/res/android"> <alpha android:fromAlpha="1.0" android:toAlpha="0.0" android:duration="3000"/></set>
rotate_anim.xml
<set xmlns:android="http://schemas.android.com/apk/res/android"> <rotate android:duration="3000" android:fromDegrees="0" android:pivotX="50%" android:pivotY="50%" android:toDegrees="+360"/></set>
scale_anim.xml
<scale android:fromXScale="0.0" android:fromYScale="0.0" android:toXScale="1.0" android:toYScale="1.0" android:pivotX="90%" android:pivotY="90%" android:duration="3000"/></set>
translate_anim.xml
<set xmlns:android="http://schemas.android.com/apk/res/android"> <translate android:fromXDelta="0" android:fromYDelta="0" android:toXDelta="200" android:toYDelta="0" android:duration="3000"/></set>
activity_main.xml布局文件
<Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="开始动画" android:onClick="startClick" android:id="@+id/button" android:layout_alignParentTop="true" android:layout_alignParentStart="true" android:layout_alignParentEnd="true"/> <ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:maxWidth="200dp" android:minHeight="200dp" android:adjustViewBounds="true" android:src="@mipmap/jj" android:id="@+id/imageView" android:layout_alignParentBottom="true" android:layout_centerHorizontal="true"/> <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="frame动画" android:onClick="frameClick" android:id="@+id/button2" android:layout_below="@+id/button" android:layout_alignParentStart="true" android:layout_alignEnd="@+id/button"/> <ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/anim_list" android:id="@+id/imageView2" android:layout_above="@+id/imageView" android:layout_centerHorizontal="true"/></RelativeLayout>
public class MainActivity extends AppCompatActivity { private ImageView imageView; private ImageView imageView2; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); imageView = (ImageView) findViewById(R.id.imageView); imageView2 = (ImageView) findViewById(R.id.imageView2); } public void frameClick(View view){ AnimationDrawable ad = (AnimationDrawable) imageView2.getDrawable();// ad.start(); ad.stop(); } public void startClick(View view){ Animation alpha = AnimationUtils.loadAnimation(this,R.anim.alpha_anim);// imageView.startAnimation(alpha); Animation scale = AnimationUtils.loadAnimation(this,R.anim.scale_anim);// imageView.startAnimation(scale); Animation translate = AnimationUtils.loadAnimation(this,R.anim.translate_anim);// imageView.startAnimation(translate); Animation rotate = AnimationUtils.loadAnimation(this,R.anim.rotate_anim); imageView.startAnimation(rotate); }}
0 0
- 补间(Tween)动画
- 补间动画Tween
- 补间(Tween)动画
- Tween(补间动画)
- Tween 补间动画
- Tween补间动画
- 补间动画(Tween)
- Tween Animation 补间动画
- 补间( Tween)动画
- NGUI Tween补间动画
- Android 动画--补间动画(Tween Animation)
- Android tween动画(补间动画)
- Android 补间动画(Tween)之一 Tween动画与Interpolator
- 使用 补间动画(Tween Animation)
- Tween(补间)动画 之 安卓
- android tween animation 补间动画
- 补间动画实现(tween)
- 补间动画(Tween)的实现
- 摄像头采集方案概述
- 使用collectd监控更改采集间隔时间
- T- MVP在项目中的使用
- AndroidStudio调试技巧
- 经典递归汉诺塔
- Tween 补间动画
- TextView相关
- 为什么要用实现接口的类实例化接口呢
- 接口和自定义观察者模式
- spring bom 解决spring依赖多版本问题
- IOS中 UIFont 字体大全
- 工厂模式
- VMware Ubuntu虚拟机linux内核版本从2.6.22升级到3.6.0-rc7
- android之官方下拉刷新组件SwipeRefreshLayout