歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
您现在的位置: Linux教程網 >> UnixLinux >  >> Linux編程 >> Linux編程

Android 歡迎界面設置

Android  歡迎界面步驟是主界面(就是顯示一出來的歡迎界面)構造方法裡面開啟一個進程,然後將自己finish掉

代碼:

WelcomeA.java:

package com.example.welcome;

import android.os.Bundle;
import android.os.Handler;
import android.app.Activity;
import android.content.Intent;

public class WelcomeA extends Activity {

 @Override
 protected void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  setContentView(R.layout.main);
  new Handler().postDelayed(new Runnable() {
   @Override
   public void run() {
    Intent intent = new Intent(WelcomeA.this, WhatsnewPagesA.class);
    startActivity(intent);
    WelcomeA.this.finish();
   }
  }, 2000);
 }
}

hello.java:

package com.example.welcome;

import android.app.Activity;
import android.os.Bundle;
import android.view.Menu;

public class WhatsnewPagesA extends Activity {
 @Override
 protected void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_main);
 }

 @Override
 public boolean onCreateOptionsMenu(Menu menu) {
  // Inflate the menu; this adds items to the action bar if it is present.
  getMenuInflater().inflate(R.menu.main, menu);
  return true;
 }
}

更多Android相關信息見Android 專題頁面 http://www.linuxidc.com/topicnews.aspx?tid=11

Copyright © Linux教程網 All Rights Reserved