dev/aos

[AOS] 스플래시 Splash 없애기

캄춰 2023. 12. 12. 14:58
728x90
반응형

안드로이드 12, API 31 이상부터 앱 시작시 스플래시 아이콘이 표출된다.

분명히 없앴던 기억이 있는데, 플루터를 하면서 다시 정리가 필요하게 되었다.

 

프로젝트 창에 폴더를 하나 생성한다.

: values-v31

 

그리고 theme파일을 생성한다.

 

 

이 테마는 AndroidManifest.xml에 application theme에 적용될 테마와 동일해야 한다.

 

스타일은 다음과 같다

: windowIsTranslucent를 true로 설정해주어야 완전히 제거가 된다.

<?xml version="1.0" encoding="utf-8"?>
<resources>

    <!--
    Android 12이상부터 앱 아이콘이 Splash에서 크게 표출된다
    해당 애니메이션과 이미지를 삭제하고 싶은 경우 아래와 같이 설정
    -->
    <style name="Theme.Base" parent="Theme.AppCompat.NoActionBar">
        <item name="android:windowSplashScreenAnimatedIcon">@drawable/splash_logo</item>
        <item name="android:windowSplashScreenAnimationDuration">0</item>
        <item name="android:windowSplashScreenBackground">@android:color/transparent</item>
        <item name="android:windowIsTranslucent">true</item>
    </style>
</resources>

 

 

이제 플루터로 넘어가보자

2023.12.12 - [dev/flutter] - [Flutter] 스플래시(Splash, Intro)

플루터에서 제공하는 flutter_native_splash는 모두 삭제한다

cmd : dart run flutter_native_splash:remove

 

그리고 android의 Manifest에서 theme를 변경해준다.

 

 

values / styles.xml

<style name="NoSplash" parent="NormalTheme">
    <item name="android:windowIsTranslucent">true</item>
</style>

 

 

values-v31 / styles.xml

<style name="NoSplash" parent="NormalTheme">
    <item name="android:windowIsTranslucent">true</item>
    <item name="android:windowSplashScreenBackground">@android:color/transparent</item>
    <item name="android:windowSplashScreenAnimationDuration">0</item>
    <item name="android:windowSplashScreenIconBackgroundColor">@android:color/transparent</item>
    <item name="android:windowSplashScreenAnimatedIcon">@android:color/transparent</item>
</style>

 

 

Manifest / application - activity

android:theme="@style/NoSplash"

 

 

 

문제는 이렇게하면 앱이 바로 띄어지는 것이 아니라 뭔가 주춤한 뒤에 띄어지게 되는 것이 약간 부자연스럽다

728x90
반응형