其实我做这个例子网上也有,不过下载他们的代码需要积分我的不用 呵呵
1新建动画效果
<?xml version="1.0" encoding="UTF-8"?>
<rotate xmlns:android="http://schemas.android.com/apk/res/android"
android:duration="2000"
android:fromDegrees="0"
android:interpolator="@android:anim/linear_interpolator"
android:pivotX="50%"
android:pivotY="50%"
android:repeatCount="infinite"
android:toDegrees="+360" />
2Activity代码
package com.example.test3;
import android.app.Activity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
public class MainActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Animation anim = AnimationUtils.loadAnimation(this, R.anim.round_loading);
findViewById(R.id.loadingBtn).startAnimation(anim);
}
}
代码下载地址http://download.csdn.net/detail/but455/8826597