关闭 Android SplashScreen(闪屏)

SplashScreen在Android 12上是强制的,如果你什么都不做,你的App在Android 12上就会自动拥有SplashScreen界面

但是这个SplashScreen界面太局限了能改的地方太少了

其实也没什么他主要作用是为了在App启动初始化的时候避免让用户在一个空白界面等待过长时间,一定程度上提升用户体验。

关闭这个闪屏也简单 把启动Activity的主题替换一下就好了比如:

XML 复制代码
    <style name="SplashScreen" parent="Theme.AppCompat.Light.NoActionBar">
        <item name="android:windowNoTitle">true</item>
        <item name="android:windowBackground">@android:color/transparent</item>
        <item name="android:windowIsTranslucent">true</item>
        <item name="android:screenOrientation">portrait</item>
        <item name="android:statusBarColor">@android:color/transparent</item>
    </style>

如果你想自定义SplashScreen 可以继承R.style.Theme_SplashScreen 或者 R.style.Theme_SplashScreen_IconBackground.参考
SplashScreen | Android Developers

相关推荐
alexhilton6 小时前
Compose中的CameraX二维码扫描器
android·kotlin·android jetpack
eric*16889 小时前
Android15 enableEdgeToEdge 全面屏沉浸式体验
android·edgetoedge
小智社群11 小时前
小米安卓真机ADB对硬件操作
android·adb
嗷o嗷o11 小时前
Android BLE 为什么连上了却收不到数据
android
pengyu11 小时前
【Kotlin 协程修仙录 · 炼气境 · 后阶】 | 划定疆域:CoroutineScope 与 Android 生命周期的绑定艺术
android·kotlin
朝星11 小时前
Android开发[5]:组件化之路由+注解
android·kotlin
随遇丿而安11 小时前
Android全功能终极创作
android
随遇丿而安11 小时前
第1周:别小看 `TextView`,它其实是 Android 页面里最常被低估的组件
android
summerkissyou198715 小时前
Android-基础-SystemClock.elapsedRealtime和System.currentTimeMillis区别
android
ian4u15 小时前
车载 Android C++ 完整技能路线:从基础到进阶
android·开发语言·c++