闪屏 API 显示 Android 12 的操作栏

Kun*_*war 8 android splash-screen kotlin android-12

启动画面加载后,我得到一个操作栏,但我已将postSplashScreenTheme设置为无操作栏主题。这种情况仅发生在 android 12 模拟器上。

<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:tools="http://schemas.android.com/tools">
    <style name="Theme.App.Starting" parent="Theme.SplashScreen">
        <item name="windowSplashScreenBackground">@color/white</item>

        <item name="windowSplashScreenAnimatedIcon">@drawable/splash_icon</item>
        <item name="postSplashScreenTheme">@style/Theme.Design.NoActionBar</item>
        <item name="windowSplashScreenIconBackgroundColor">@color/blue</item>
        <item name="windowSplashScreenAnimationDuration">800</item>

        <item name="android:forceDarkAllowed" tools:targetApi="q">false</item>
    </style>
</resources>
Run Code Online (Sandbox Code Playgroud)

Fil*_*oli 10

在您的启动器活动中添加安装功能

class MainActivity : Activity() {

   override fun onCreate(savedInstanceState: Bundle?) {
       installSplashScreen()

       super.onCreate(savedInstanceState)
       setContentView(R.layout.main_activity)

       ...
Run Code Online (Sandbox Code Playgroud)

https://developer.android.com/guide/topics/ui/splash-screen/migrate#migrate_your_splash_screen_implementation


Kun*_*war 4

我在 onCreate 中调用 actionBar?.hide() ,似乎按预期工作。

actionBar?.hide()
Run Code Online (Sandbox Code Playgroud)