xml Android应用启动画面。参考 - https://www.bignerdranch.com/blog/splash-screens-the-right-way/

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了xml Android应用启动画面。参考 - https://www.bignerdranch.com/blog/splash-screens-the-right-way/相关的知识,希望对你有一定的参考价值。

<!--Launch Screen-->
<style name="AppTheme.LaunchScreen" parent="AppTheme.NoActionBar">
    <item name="android:windowBackground">@drawable/launch_screen</item>
</style>
<?xml version="1.0" encoding="utf-8"?>
<layer-list
    xmlns:android="http://schemas.android.com/apk/res/android">

    <item android:drawable="@color/red_500"/>

    <item>
        <bitmap
            android:gravity="center"
            android:src="@mipmap/ic_launcher"/>
    </item>

</layer-list>
package me.kalehv.popmovie;

import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;

public class LaunchActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        // Do Whatever is needed
        
        
        // Launch Main Activity
        Intent intent = new Intent(this, MainActivity.class);
        startActivity(intent);
        finish();
    }
}
<activity
    android:name=".LaunchActivity"
    android:theme="@style/AppTheme.LaunchScreen">
    <intent-filter>
        <action android:name="android.intent.action.MAIN"/>
        <category android:name="android.intent.category.LAUNCHER"/>
    </intent-filter>
</activity>

以上是关于xml Android应用启动画面。参考 - https://www.bignerdranch.com/blog/splash-screens-the-right-way/的主要内容,如果未能解决你的问题,请参考以下文章

添加启动画面后Android应用程序强制关闭

可以在 android 和 ios 的颤振应用程序上删除启动画面

Andriod正式打包以及升级应用 重新打包 修改应用名称应用图 标应用启动画面

如何将启动画面设置为全屏?

Android 12 启动画面-SplashScreen

改动Android启动画面