Android应用的启动界面

/**
 * @(#)Start.java
 * 
 * Copyright XXX.All rights reserved.
 * This software is the XXX system. 
 *
 * @Version: XXX
 * @JDK: jdk 1.6.0.XXX
 * @Module: Statefeedback
 */ 
 /*- 		History
 **********************************************
 *  ID      DATE           PERSON       REASON
 *  1     2011-10-25    WuChaoWen    Created
 **********************************************
 */

package com.cnjmwl.scm;





import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.view.animation.AlphaAnimation;
import android.widget.ImageView;

/**
 * Class description goes here.
 *
 * @author WuChaoWen
 * @since 2011-10-25
 */
public class Start extends Activity {
	private ImageView splashImgView = null;
	private int onShowTime = 2000;
	private Class<?> nextUI = LoginActivity.class;
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		
		super.onCreate(savedInstanceState);
		setContentView(R.layout.splash);
        splashImgView =(ImageView)findViewById(R.id.splashImageView);
	}
	
	
	@Override
	protected void onStart() {
		super.onStart();
		int sIndex = 0;
		showImg(0.2f,R.drawable.logo,300);
		//showImg(0.5f,R.drawable.lurencun_logo_320dpi,onShowTime * ++sIndex);
		showImg(0.2f,R.drawable.splash,onShowTime * ++sIndex);
		new Handler().postDelayed(new Runnable(){
			@Override
			public void run() {
				startActivity(new Intent(Start.this,nextUI));
				Start.this.finish();
			}
		}, onShowTime * ++sIndex);
		
	}
	
	
	private void showImg(final float startAlpha,final int drawableId,int delay){
    	new Handler().postDelayed(new Runnable(){
			@Override
			public void run() {
				splashImgView.setImageResource(drawableId);
				AlphaAnimation animation = new AlphaAnimation(startAlpha, 1.0f);
				animation.setDuration(1000);
				splashImgView.startAnimation(animation);
			}
		},delay);
	}
}

  

原文地址:https://www.cnblogs.com/andgoo/p/2224592.html