先将启动页放到项目资源中,图片一般是1080*1920的jpg。
新建一个activity,如图:
http://www.bubuko.com/infodetail-2565708.html
public class SplashActivity extends AppCompatActivity {
private final int SPLASH_DISPLAY_LENGHT = 2000;//两秒后进入系统,时间可自行调整
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_splash);
//在BZLaunchActivity停留2秒然后进入BZLaunchActivity
new android.os.Handler().postDelayed(new Runnable() {
@Override
public void run() {
Intent mainIntent = new Intent(SplashActivity.this,MainActivity.class);
SplashActivity.this.startActivity(mainIntent);
SplashActivity.this.finish();
}
},SPLASH_DISPLAY_LENGHT);
}
}
<activity android:name=".SplashActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>