RotateAnimation旋转动画Demo
来源:互联网 发布:sys types.h windows 编辑:程序博客网 时间:2024/05/16 14:07
一、在java中实现动画:
package com.jikexueyuan.rotateanimation;import android.app.Activity;import android.os.Bundle;import android.view.View;import android.view.animation.Animation;import android.view.animation.AnimationUtils;import android.view.animation.RotateAnimation;public class MainActivity extends Activity {private RotateAnimation ra; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); ra = new RotateAnimation( 0 //fromDegrees起始角度 , 360 //toDegrees旋转角度 , Animation.RELATIVE_TO_SELF, 0.5f,//pivotXType 旋转中心的X轴 //RELATIVE_TO_SELF:相对自身 Animation.RELATIVE_TO_SELF, 0.5f//pivotXValue 旋转中心的Y轴 ); ra.setDuration(1000); findViewById(R.id.btnRotateMe).setOnClickListener(new View.OnClickListener() {@Overridepublic void onClick(View arg0) {arg0.startAnimation(ra);}}); }}
二、在ra.xml中实现动画:
package com.jikexueyuan.rotateanimation;import android.app.Activity;import android.os.Bundle;import android.view.View;import android.view.animation.AnimationUtils;import android.view.animation.RotateAnimation;public class MainActivity extends Activity {private RotateAnimation ra; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); findViewById(R.id.btnRotateMe).setOnClickListener(new View.OnClickListener() {@Overridepublic void onClick(View arg0) {arg0.startAnimation(AnimationUtils.loadAnimation(MainActivity.this, R.anim.ra));}}); }}
ra.xml:
<?xml version="1.0" encoding="utf-8"?><rotate xmlns:android="http://schemas.android.com/apk/res/android" android:fromDegrees="0" android:toDegrees="360" android:duration="1000" android:pivotX="50%" android:pivotY="50%" ></rotate>
0 1
- RotateAnimation旋转动画Demo
- 旋转动画 RotateAnimation
- 旋转动画RotateAnimation
- RotateAnimation类:旋转变化动画类
- Android利用RotateAnimation实现旋转变化动画
- RotateAnimation类:旋转变化动画类
- RotateAnimation类:旋转变化动画类
- RotateAnimation类:旋转变化动画类
- RotateAnimation类:旋转变化动画类
- RotateAnimation类:旋转变化动画类
- RotateAnimation类:旋转变化动画类
- Android RotateAnimation动画不能旋转的问题
- 旋转动画——RotateAnimation的讲解
- android RotateAnimation设置中心点旋转动画
- RotateAnimation类:旋转变化动画类
- android RotateAnimation设置中心点旋转动画
- Android动画 之 Tween Animation(RotateAnimation 旋转动画)
- AndroidUI 视图动画-旋转动画效果 (RotateAnimation)
- Datatable 添加新列并赋值
- android的事件分发相关
- 封装的viewholder和adapter
- Windows下更改MySQL数据库的存储位置
- AndroidStudio快捷键
- RotateAnimation旋转动画Demo
- 浅谈Java Final关键字
- C 常用函数整理
- 面试笔试技巧
- Python学习手册 - 10
- js省市联动,多版本,总有你喜欢的
- iOS分享【OC】—— UITableView 的 cell 自适应
- Java反射初步学习
- html5的页面缓存和本地数据存储支持