Android 如何将欢迎图片添加到我的应用程序?

Android 如何将欢迎图片添加到我的应用程序?,android,xml,image,apk,splash-screen,Android,Xml,Image,Apk,Splash Screen,如何将欢迎图片添加到我的应用程序?飞溅运动?有人能解释一下它是如何工作的吗。我和安卓一起工作。MT manager它是一款Android移动APK。当你启动我的应用程序时,我想看我的欢迎图片1-3秒。我是如何做到这一点的?首先,您必须为applocation开始(欢迎屏幕)或(启动屏幕)创建一个布局,并在其中添加您想要的内容,在我的情况下,我将其称为“启动布局”,然后将这些代码添加到您的主要活动中 它是这样做的: import android.content.Intent; import an

如何将欢迎图片添加到我的应用程序?飞溅运动?有人能解释一下它是如何工作的吗。我和安卓一起工作。MT manager它是一款Android移动APK。当你启动我的应用程序时,我想看我的欢迎图片1-3秒。我是如何做到这一点的?

首先,您必须为applocation开始(欢迎屏幕)或(启动屏幕)创建一个布局,并在其中添加您想要的内容,在我的情况下,我将其称为“启动布局”,然后将这些代码添加到您的
主要活动中


它是这样做的:

import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.view.View;

import androidx.appcompat.app.AppCompatActivity;



public class MainActivity extends AppCompatActivity {

int seconds_in_millis = 2000 ;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    // here the welcome screen will show
    setContentView(R.layout.splash_layout);

    // this code makes the main screen shows after 2 seconds
    new Handler().postDelayed(new Runnable() {
        @Override
        public void run() {
            setContentView(R.layout.activity_main);
        }
    },seconds_in_millis) ;
}


}


最后,每1000毫秒=1秒。

这是否回答了您的问题?不,用手机很难做到