Android: Open the full screen page of the program

This is the effect shown:

If you want to do this, here's how to do it




Step One

Create a new file whenever you want. (Recommended to build on desktop first) Name the file

Init_Activity.java

Then copy the following (don't care about it, just press me first)

package com.title71.ywl.demo5;

import java.util.Timer;
import java.util.TimerTask;



import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.widget.TextView;

public class Init_Activity extends Activity{

    private TextView init_text_number;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.init_activity);
        init_text_number = (TextView)findViewById(R.id.init_text_number);
        timer_start();
    }

    private int timer_flag =3;
    private void timer_start()
    {
        final Timer timer = new Timer();
        timer.schedule(new TimerTask() {

            @Override
            public void run() {
                // TODO Auto-generated method stub

                Message msg =new Message();
                msg.what = 1;
                msg.obj = timer_flag;
                handler.sendMessage(msg);
                timer_flag--;           
                if(timer_flag < 0)
                {
                    timer_flag = 3;
                    timer.cancel();
                    Intent intent = new Intent(Init_Activity.this,MainActivity.class);
                    startActivity(intent);
                }
            }
        }, 3, 1000);    
    }


    private Handler handler =new Handler()
    {
        public void handleMessage(Message msg)
        {
            if(msg.what == 1)
            {
                init_text_number.setText(""+msg.obj);
            }
        }   
    };

}




Step 2

Create another file, init_activity.xml

Copy the following to a file

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    android:background="@drawable/init"
   >


    <TextView
        android:id="@+id/init_text_number"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:gravity="right"
        android:text="3"
        android:textColor="#FFFFFFFF"
        android:textSize="15sp" />



</LinearLayout>




Step 3

Find a picture named init

Like this picture

Last step

Modify AndroidManifest.xml

This file from Androidstudio is in manifests

Ten million Attentions

Modify the content of my comment

Modify the content of my comment

Modify the content of my comment

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.title71.ywl.demo5">

    <uses-permission android:name="android.permission.INTERNET"/>

    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">
      <!--Load full screen page first-->  <activity android:name=".Init_Activity" android:theme="@android:style/Theme.Wallpaper.NoTitleBar.Fullscreen"><!--Load full screen page first-->
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <!--Add your own home page--><activity android:name=".MainActivity"> </activity><!--Add your own home page-->
    </application>

</manifest>

Finally copy the file to the corresponding project directory (studio prompts will help you modify the contents by default)

If there is no error, it is ok ay. If there is an error, the main file name may have been changed by you, not MainActivity.

Tags: Android xml Java encoding

Posted on Sun, 15 Mar 2020 10:48:46 -0700 by johnsiilver