Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

172
Visualizações
Android 12 Splash Screen API customization

Since Android released the new Splash Screen API with Android 12, a lot of apps had issues with duplicate splash screens, lack of customization, etc.

Right now, it is possible to set the background color and icon in the middle of it, but is it possible to customize it a bit more? Since right now we are limited to use single-colored background and non-resizable logo icon which doesn't look quite good.

What I'm trying to achieve is a custom splash screen, with an image drawable as background (or layer-list with 2 items - one background image and one centered logo), as it could be used before Android 12.

Did someone succeed to achieve this type of behavior?

There is a workaround to set windowIsTranslucent attribute to true and show only the second splash (the right one), but it introduces bad UX since it seems like the app is not responding for a few seconds.

over 4 years ago · Hanz Gallego
1 Respostas
Responde à pergunta

0

I did something like this. First remove default drawable

 <style name="Theme.App.Starting" parent="Theme.SplashScreen">
      <item name="windowSplashScreenBackground">@color/...</item>
      <item name="windowSplashScreenAnimatedIcon">@android:color/transparent</item>
      <item name="postSplashScreenTheme">@style/AppTheme</item>
</style>

Then inflate your custom splash view

class MainActivity : AppCompatActivity(), SplashScreen.OnExitAnimationListener {

      override fun onCreate(savedInstanceState: Bundle?) {
          super.onCreate(savedInstanceState)
          val installSplashScreen = installSplashScreen()
          installSplashScreen.setOnExitAnimationListener(this)
          setContentView(R.layout.activity_main)
      }


      override fun onSplashScreenExit(splashScreenViewProvider: SplashScreenViewProvider) {
           val view = splashScreenViewProvider.view
           if (view is ViewGroup) {
               val binding = ActivityMainSplashBinding.inflate(layoutInflater,view, true)
               // Do what you want with your inflated view
               animate(view) {
                   // Remove splash
                   splashScreenViewProvider.remove()
               }
           }
       }



     private fun animate(view: View, doOnFinish: () -> Unit) {
         view.animate()
        .withEndAction(doOnFinish)
        .start()
     }
}

At the end remember to call splashScreenViewProvider.remove() to remove splash.

over 4 years ago · Hanz Gallego Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda