zoukankan      html  css  js  c++  java
  • 安卓开发学习笔记(六):如何实现指定图片定时开屏功能?

    首先我们先展示其代码:

    Lauch.java

    import android.content.Intent;
    import android.os.Bundle;
    import android.os.Handler;
    import android.support.v7.app.AppCompatActivity;
    import android.view.WindowManager;
    
    public class Launch extends AppCompatActivity {
    
    
    
        @Override
        public void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.activity_launch);
            getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
            getSupportActionBar().hide();
            new Handler().postDelayed(new Runnable(){ // 为了减少代码使用匿名Handler创建一个延时的调用
                public void run() {
                    Intent i = new Intent(Launch.this, FirstActivity.class); //通过Intent打开最终真正的主界面的FirstActivity,相当于界面的跳转

            Launch.this.startActivity(i); //启动Main界面

            Launch.this.finish(); //关闭自己这个开场屏 } }, 1000); //1秒,够用了吧,这里是写自己开屏的时间,想写多少写多少。 } }

    上述代码还是很好理解的,这段代码用于我们第一个活动的开启,之后我们还需要在manifast文件把这个活动主活动注册成主活动就可以了(重要!!!),因为这是APP开始的第一个活动!

  • 相关阅读:
    my first android test
    VVVVVVVVVV
    my first android test
    my first android test
    my first android test
    ini文件
    ZZZZ
    Standard Exception Classes in Python 1.5
    Python Module of the Week Python Module of the Week
    my first android test
  • 原文地址:https://www.cnblogs.com/geeksongs/p/9967932.html
Copyright © 2011-2022 走看看