gpt4 book ai didi

android - 暗模式下不支持闪屏 API

转载 作者:行者123 更新时间:2023-12-04 23:42:56 36 4
gpt4 key购买 nike

我正在尝试实现启动画面。
我已经按照启动画面 API 方法实现了implementation 'androidx.core:core-splashscreen:1.0.0-alpha02'飞溅.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>
list .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)
}
}
在深色模式下仍然显示黑色图标
splash screen dark mode
并在灯光模式下完美工作
splash screen light mode

Device Name: Xiaomi Redmi Note 7 Pro,
Android Version: Android 10 (SDK 29)

最佳答案

改变这个:

<item name="postSplashScreenTheme">@style/Theme.SplashScreenApi</item>
对此:
<item name="postSplashScreenTheme">@style/AppTheme</item>
(其中 AppTheme 是您的主题名称)
此外,无需在 Activity 和应用程序中应用 Splash 主题。所以我建议你在 中更改它申请标签 :
android:theme="@style/Theme.App.Start"
对此:
android:theme="@style/AppTheme"

关于android - 暗模式下不支持闪屏 API,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/70619915/

36 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com