[英]Splash Theme is not changing anymore
我按照此链接创建了一个SplashActivity,在加载MainActivity时显示一个小图标。 Everythink工作正常,我可以成功实现图标。 现在我正在尝试更改SplashActivity的图标,但问题是我的设备上的应用程序中的图标未更新。 我在代码中更改的所有其他内容都将更新成功期望主题。
window_background.xml:
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android"
android:opacity="opaque">
<item android:drawable="@color/white"/>
<item>
<bitmap
android:src="@drawable/logo"
android:gravity="center"/>
</item>
</layer-list>
styles.xml:
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>
<style name="AppTheme.LauncherTheme">
<item name="android:windowBackground">@drawable/window_background</item>
</style>
AndroidManifest.xml中:
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme">
<activity android:name=".SplashActivity"
android:theme="@style/AppTheme.LauncherTheme"
android:screenOrientation="sensorPortrait">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
...
</application>
我几乎尝试了所有更新代码(清洁项目,重建项目,无效缓存,重启Android Studio,删除设备上的应用程序等),但只是主题在设备上无法正常工作,其他一切正常。
有没有人有解决方案如何显示正确的主题?
编辑:即使我从mainfest文件中删除主题,主题仍然存在..
编辑2:我发现当前显示的图标是标准的ic_launcher图标,它位于中间。 所以window_background.xml完全被主题忽略,我仍然不知道为什么。 我还尝试将不同的主题设置为AppTheme.LauncherTheme的父级,但它不会改变任何内容。 如果我删除了AppTheme.LauncherTheme,那么SplashActivity将是emtpy并且ic_launcher图标将被删除。
AppTheme.LauncherTheme
应该扩展一个Theme.AppCompat
主题。 我建议这样解决方案:
<style name="AppTheme.LauncherTheme" parent="AppTheme">
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.