【发布时间】:2022-03-30 19:18:10
【问题描述】:
我正在尝试实现启动画面。
我已经按照闪屏 API 方法实现了
implementation 'androidx.core:core-splashscreen:1.0.0-alpha02'
splash.xml
<style name="Theme.App.Start" parent="Theme.SplashScreen">
<item name="windowSplashScreenBackground">#FFF</item>
<item name="windowSplashScreenAnimatedIcon">@drawable/ic_baseline_baby_changing_station_24</item>
<item name="postSplashScreenTheme">@style/Theme.SplashScreenApi</item>
</style>
splash.xml(用于暗模式)
<style name="Theme.App.Start" parent="Theme.SplashScreen">
<item name="windowSplashScreenBackground">#3A3A3A</item>
<item name="windowSplashScreenAnimatedIcon">@drawable/ic_baseline_baby_changing_station_24</item>
<item name="postSplashScreenTheme">@style/Theme.SplashScreenApi</item>
</style>
Manifest.xml
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.App.Start">
<activity
android:name=".MainActivity"
android:exported="true"
android:theme="@style/Theme.App.Start">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
MainActivity.kt
class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
installSplashScreen()
setContentView(R.layout.activity_main)
}
}
深色模式下仍然显示黑色图标
在光照模式下完美工作
设备名称:小米红米 Note 7 Pro,
Android 版本:Android 10 (SDK 29)
【问题讨论】:
-
你尝试过其他一些图标吗?
-
@SujalKumar 是的,我也试过了。
-
你试过 beta01 吗?
-
@VadimCaen 我试过了。但仍然无法正常工作。先生,您能分享在其他设备上正常工作的任何启动画面 api 项目吗?谢谢。
标签: android splash-screen android-12