设置APP进去的第一张图片 然后跳转到别的 Activity
import android.support.v7.app.ActionBar;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.content.Intent;
import android.os.Handler;
import android.os.Message;
import android.view.Window;
import android.view.WindowManager;
public class WelcomeActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);//这里取消标题设置
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);//这里全屏显示
setContentView(R.layout.activity_welcome);
ActionBar actionBar=getSupportActionBar();
if(actionBar!=null){
actionBar.hide();
} //这里将自带的标题栏隐藏掉
handler.sendEmptyMessageDelayed(0,3000); //定个时 3秒
}
private Handler handler = new Handler() {
@Override
public void handleMessage(Message msg) {
getHome();
super.handleMessage(msg);
}
}; //消息处理对象,负责发送与处理消息
public void getHome(){
Intent intent = new Intent(WelcomeActivity.this, helloActivity.class);
startActivity(intent);
finish();
}
}
布局文件
设置进来是WelcomeActivity 这个页面