<?xml version="1.0" encoding="utf-8"?><set xmlns:android="http://schemas.android.com/apk/res/android" > <rotate android:duration="5000" android:fromDegrees="0" android:pivotX="50%" android:pivotY="50%" android:repeatCount="-1" android:repeatMode="restart" android:toDegrees="360" /></set>具体含义是:
</ xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:background="#ff00ff" ><com.example.circleimageview.CircleImageViewandroid:id="@+id/imageview" android:layout_width="100dp" android:layout_height="100dp" android:layout_centerInParent="true" android:src="@drawable/control_image" /></RelativeLayout>你也可以写成一个普通的控件都可以实现旋转
import android.os.Bundle;import android.view.animation.Animation;import android.view.animation.AnimationUtils;import android.view.animation.LinearInterpolator;import android.widget.ImageView;public class MainActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main);ImageView imageView = (ImageView) findViewById(R.id.imageview); //动画Animation animation = AnimationUtils.loadAnimation(this, R.anim.img_animation); LinearInterpolator lin = new LinearInterpolator();//设置动画匀速运动 animation.setInterpolator(lin); imageView.startAnimation(animation); }}是不是很简单,运行效果如下:录制的有点问题,实际上是匀速地。
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持脚本之家。