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); } }; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); getWindow().requestFeature(Window.FEATURE_PROGRESS); //去标题栏 setContentView(R.layout.main); animatinoGone = AnimationUtils.loadAnimation(this,R.anim.alpha_gone); //动画效果 myAnimation_Alpha = AnimationUtils.loadAnimation(this,R.anim.alpha_action); //动画效果 splash = (LinearLayout) findViewById(R.id.splashscreen); tv = (TextView) findViewById(R.id.info); tv.setText("正在建立数据连接"); splash.startAnimation(myAnimation_Alpha); Message msg = new Message(); msg.what = STOPSPLASH; splashHandler.sendMessageDelayed(msg, SPLASHTIME); }
|