You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Android Jetpack Compose中应用图标先于启动页显示问题求助

问题:Android应用自定义启动页前先显示应用图标,如何消除该现象?

我开发了一款字典应用,设置了自定义启动页并在其中展示一张图片。修改应用图标后,启动应用时,应用图标会先于启动页图片显示一段时间,但使用默认图标时并未出现该问题。我希望仅显示启动页的自定义图片,且应用图标与启动页图片不同。

我的启动页代码:

@Composable
fun SplashScreen(
    navController: NavController,
    viewModel : SplashScreenViewModel = hiltViewModel()) {


    val context: Context = LocalContext.current



    val scale = remember {
        Animatable(0f)
    }

    LaunchedEffect(key1 = true) {
        scale.animateTo(
            targetValue = 1f,
            animationSpec = tween(
                durationMillis = 500,
                easing = {
                    OvershootInterpolator(2f).getInterpolation(it)
                }
            )
        )


        delay(3000L)

        navController.navigate(Screen.MainScreen.route)
    }


    Box(
        modifier = Modifier.fillMaxSize(),
        contentAlignment = Alignment.Center
    ) {

        Image(
            painter = painterResource(id = R.drawable.ic_splash_screen_dictionary2),
            contentDescription = "Logo",
            modifier = Modifier.scale(scale.value)
        )
    }


}

解决方法

通过Composable实现启动页的方式存在问题。此前参考大量项目采用该方式,但未使用Splash API时,Android会自动将应用图标作为默认启动页。由于首个页面是SplashScreen,Android默认的应用图标会先显示,再加载自定义启动页。最终通过官方推荐的Splash API解决了问题。


内容的提问来源于stack exchange,提问作者NewPartizal

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.07 07:45:19