旧的可绘制对象出现在启动画面中
Old drawable appears in the splash screen
我的启动画面有问题。我从 drawable(我们称它为 'black' 因为它有黑色背景)开始,它不是很好,所以我将其更改为另一个(我们称它为 'white')。
问题是,黑色可绘制对象甚至出现了 ~1 秒,之后出现 'white',在改造完成请求和 MainActivity 启动之后。我已尝试 clean/rebuild、使缓存失效、重新安装应用程序。但没有任何效果。在类似的 SO 问题中,我发现我应该尝试在另一台设备上启动应用程序,但不幸的是,我只有一个,并且不得不使用它。那么,是否可以修复它,或者它是 AndroidStudio 中的错误?
清单
<activity android:name=".ui.splash.SplashActivity"
android:theme="@style/SplashTheme">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
splash_drawable.xml
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<color android:color="@android:color/white" />
</item>
<item
android:drawable="@drawable/gift"
android:gravity="center">
</item>
</layer-list>
SplashTheme
<style name="SplashTheme" parent="Theme.AppCompat.NoActionBar">
<item name="android:windowBackground">@drawable/splash_drawable</item>
</style>
SplashTheme(v-21)
<style name="SplashTheme" parent="Theme.AppCompat.NoActionBar">
<item name="android:windowBackground">@drawable/splash_drawable</item>
<item name="android:statusBarColor">@android:color/white</item>
</style>
有时 android studio 不会像 images.so 那样刷新可绘制文件,请关闭您的 android studio 并重新启动它可能会解决问题。
我的启动画面有问题。我从 drawable(我们称它为 'black' 因为它有黑色背景)开始,它不是很好,所以我将其更改为另一个(我们称它为 'white')。
问题是,黑色可绘制对象甚至出现了 ~1 秒,之后出现 'white',在改造完成请求和 MainActivity 启动之后。我已尝试 clean/rebuild、使缓存失效、重新安装应用程序。但没有任何效果。在类似的 SO 问题中,我发现我应该尝试在另一台设备上启动应用程序,但不幸的是,我只有一个,并且不得不使用它。那么,是否可以修复它,或者它是 AndroidStudio 中的错误?
清单
<activity android:name=".ui.splash.SplashActivity"
android:theme="@style/SplashTheme">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
splash_drawable.xml
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<color android:color="@android:color/white" />
</item>
<item
android:drawable="@drawable/gift"
android:gravity="center">
</item>
</layer-list>
SplashTheme
<style name="SplashTheme" parent="Theme.AppCompat.NoActionBar">
<item name="android:windowBackground">@drawable/splash_drawable</item>
</style>
SplashTheme(v-21)
<style name="SplashTheme" parent="Theme.AppCompat.NoActionBar">
<item name="android:windowBackground">@drawable/splash_drawable</item>
<item name="android:statusBarColor">@android:color/white</item>
</style>
有时 android studio 不会像 images.so 那样刷新可绘制文件,请关闭您的 android studio 并重新启动它可能会解决问题。