目前,我通过将应用程序主题设置为可绘制图像,制作了一个非常低分辨率的闪屏。如果不是this,这将完美地工作。现在我正在寻找替代方案。
我不会做的一件事就是创建一个定时的启动画面,其中有很多指导如何制作一个,我想知道的一件事是如何创建一个首先加载的启动画面,然后完成MainActivity
完成加载后?
我喜欢当前的防溅屏幕的一件事是它会在应用程序启动时立即加载,但如果它是高分辨率(超过300x300像素),则单击按钮会导致严重延迟。
这是我目前的代码,用于根据MainActivity
的加载状态加载和停止有缺陷的延迟启动画面:
styles.xml
中的:
<style name="splashscreenTheme" parent="Theme.AppCompat.Light.NoActionBar">
<!-- Customize your theme here. -->
<item name="android:windowBackground">@drawable/splashscreen</item>
</style>
in manifest:
AndroidManifest.xml
中的:
<application
android:allowBackup="true"
android:icon="@drawable/logo"
android:label="@string/app_name"
android:fullBackupContent="false"
android:theme="@style/AppTheme">
<activity
android:name=".MainActivity"
android:screenOrientation="portrait"
android:label="@string/app_name"
android:theme="@style/splashscreenTheme">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
</application>
</manifest>
答案 0 :(得分:1)
检查透支可能存在的问题。似乎背景(飞溅图像)仍然存在。如果它适用于您的情况,请参阅http://www.curious-creature.org/2012/12/01/android-performance-case-study/。
删除窗口背景:系统使用主题中定义的背景在启动应用程序时创建预览窗口。除非您的应用程序是透明的,否则永远不要将其设相反,通过调用getWindow()将其设置为您想要的颜色/图像或从onCreate()中删除.setBackgroundDrawable(null)。