android程序启动画面-Splash
2012-09-07 12:24:02 来源:WEB开发网有一个id为splashscreen 的linearlayout,是程序启动时显现的部分。id为browser是程序的主界面显示部分。
package net.hlovey.s;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.LinearLayout;
import android.widget.TextView;
import android.widget.Toast;
public class WebGameActivity extends Activity {
private WebView webView;
private Handler mHandler = new Handler();
private static final String TAG = "WebGameActivity";
//菜单
private static final int MENU_RELOAD = Menu.FIRST;
private static final int MENU_HELP = Menu.FIRST + 1;
private static final int MENU_ABOUT = Menu.FIRST + 2;
private static final int MENU_CLOSE = Menu.FIRST + 3;
private int staus = 0;
private static final int STOPSPLASH = 0;
//time in milliseconds
private static final long SPLASHTIME = 1000;
private LinearLayout splash;
private TextView tv;
private Animation myAnimation_Alpha;
private Animation animatinoGone ;
private Handler splashHandler = new Handler() {
public void handleMessage(Message msg) {
switch (msg.what) {
case STOPSPLASH:
if( staus == 1 ){
splash.startAnimation(animatinoGone);
splash.setVisibility(View.GONE);
break;
}
sendEmptyMessageDelayed(STOPSPLASH, SPLASHTIME);
}
super.handleMessage(msg);
}
更多精彩
赞助商链接