首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 移动开发 > 移动开发 >

卡通 rotate 让一张图片以它的中心旋转

2012-08-26 
动画rotate 让一张图片以它的中心旋转1 在layout/anim下建立一个anim.xml文件?xml version1.0 encodin

动画 rotate 让一张图片以它的中心旋转

1 在layout/anim下建立一个anim.xml文件

<?xml version="1.0" encoding="utf-8"?>

<set xmlns:android="http://schemas.android.com/apk/res/android">

? <rotate?

? ? ? ? android:interpolator="@android:anim/accelerate_decelerate_interpolator"

? ? ? ? android:fromDegrees="0"?

? ? ? ? android:toDegrees="+360" ? ? ? ??

? ? ? ? android:pivotX="50%"?

? ? ? ? android:pivotY="50%" ? ??

? ? ? ? android:duration="3000" /> ??

</set>

?

在activity 中应用:

? ? ? ?Animation anim = AnimationUtils.loadAnimation(this, R.anim.splashanim);

? ? ? findViewById(R.id.sun).startAnimation(anim);

R.id.sun是一个imageview控件,这个控件中有一个图片,本文例子就是让这张图片以它的中心旋转。

热点排行