我已经使用 a 实现了新的 Android Splash Screen API,RoutingActivity
因为我的应用程序无法将其分解为单个活动应用程序。根据开发人员文档,推荐的方法如下:
class RoutingActivity : Activity() {
override fun onCreate(savedInstanceState: Bundle?) {
val splashScreen = installSplashScreen()
super.onCreate(savedInstanceState)
// Keep the splash screen visible for this Activity
splashScreen.setKeepOnScreenCondition { true }
startSomeNextActivity()
finish()
}
这似乎在某些设备上运行良好,但在其他设备上,它有时会保持超过 8-12 秒。我在创建后添加了一个带有计时器的日志,只是为了查看何时执行。5秒后达到。
有什么办法可以让启动画面更快地完成?