public class SplashScreen extends Activity {
private static int SPLASH_TIME_OUT = 30000;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.splash);
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
// This method will be executed once the timer is over
// Start your app main activity
Intent i = new Intent(SplashScreen.this, MainActivity.class);
startActivity(i);
// close this activity
finish();
}
}, SPLASH_TIME_OUT);
}
答案 0 :(得分:3)
对于图像旋转,请使用以下代码:
ImageView rotate_image =(ImageView) findViewById(R.id.splash_Rotate);
RotateAnimation rotate = new RotateAnimation(30, 360, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
rotate.setDuration(2500);
rotate_image.startAnimation(rotate);
答案 1 :(得分:1)
对于API 11+,这应该围绕它的中心旋转图像
yourView.setPivotX(yourView.getWidth() / 2);
yourView.setPivotY(yourView.getHeight() / 2);
float rotation = 360f;
yourView.setRotation(rotation);