I have application with white color status bar and navigation bar. I have define a Splash theme like this.
<style name="Theme.MySplash" parent="Theme.SplashScreen">
<item name="windowSplashScreenBackground">#00f</item>
<item name="windowSplashScreenAnimatedIcon">@drawable/ic_baseline_play_arrow_24</item>
<item name="windowSplashScreenAnimationDuration">200</item>
<item name="postSplashScreenTheme">@style/Theme.AppTheme</item>
</style>
<style name="Theme.AppTheme" parent="Theme.MaterialComponents.DayNight.NoActionBar">
<item name="android:statusBarColor">#fff</item>
<item name="android:navigationBarColor">#fff</item>
</style>
MainActivity
class MainActivity : AppCompatActivity() {
var keepSplashScreen = true
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
val splashScreen = installSplashScreen()
splashScreen.setOnExitAnimationListener { splashScreenProvider ->
val fadeAnim = ObjectAnimator.ofFloat(
splashScreenProvider.view, View.ALPHA, 1f, 0f
)
fadeAnim.duration = 4000L
fadeAnim.interpolator = AccelerateInterpolator()
fadeAnim.doOnEnd { splashScreenProvider.remove() }
fadeAnim.start()
}
splashScreen.setKeepVisibleCondition { keepSplashScreen }
setContentView(R.layout.activity_main)
Handler(Looper.getMainLooper()).postDelayed({
keepSplashScreen = false
}, 3000)
}
}
SplashTheme
working well on device Android 12 (Pixel 4XL) but on Android 8 (Xiomi A2), the SplashTheme
won't display full screen when it exist.
From this video, when SplashScreen
start exist (fade animation), the white status bar and navigation bar is display (on Android 12, SplashScreen
always fullscreen while exist).
How can I make the SplashScreen
always fullscreen on Android < 12?