要解决的问题是,点击App图标启动后要先黑屏一下才能显示静态Splash,很不美观,请看图。
有过安卓开发经验的小伙伴可能会知道,APP打开是会有一段预热时间,可以禁用掉,然后APP呈现出效果就是:点击APP图标后等待小段时间,才会跳出启动界面。OK,那我们就直接禁用掉预热吧!
首先我们要找到Unity内置的styles.xml文件。
styles.xml的目录在 Unity安装目录下的Editor\Data\PlaybackEngines\AndroidPlayer\Apk\res\values\styles.xml
找到后用 VS 打开,适当位置加一句禁用预热的代码:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="UnityThemeSelector" parent="BaseUnityTheme">
<item name="android:windowBackground">@android:color/black</item>
<!--拓展:禁用预热-->
<item name="android:windowDisablePreview">true</item>
</style>
<style name="BaseUnityTheme" parent="android:Theme.Holo.Light.NoActionBar.Fullscreen">
</style>
<style name="UnityThemeSelector.Translucent" parent="@style/UnityThemeSelector">
<item name="android:windowIsTranslucent">true</item>
<item name="android:windowBackground">@android:color/transparent</item>
</style>
</resources>
再次打包测试,效果如下: