[Android] Android 12 Splash 화면 비활성화 방법

Eunjin·2022년 5월 2일
0
post-thumbnail

안드로이드 12에서는 SplashScreen API가 추가되었습니다.(참고: 안드로이드 스플레시화면 공식문서)
SplashScreen API는 앱 상태(콜드 스타트, 웜 스타트, 핫 스타트)에 따라 실행되는데 안드로이드 12부터는 강제적으로 적용해야합니다.

하지만 이 API가 제한적이라 자유로운 Splash 화면 커스텀이 어려워졌고, 비활성화 시키는 옵션은 현재기준(2022.05.02) 나오지 않았습니다.

그래서 전 splash 창 중앙의 아이콘을 투명으로 처리하여 splah를 실행시키고, 그 다음에 저희가 적용한 splah 화면을 띄우는 것으로 해결하였습니다.

  • drawable -> launch_transparent.xml
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:color="@android:color/transparent"/>
</selector>

나중에 splash api를 사용할 경우에 띄울 아이콘은 launch_background.xml에 그대로 두고, 현재는 아이콘이 표시되지 않도록 하기위해 투명한 배경을 만들었습니다.

  • app/.../styles.xml
    <style name="LaunchTheme" parent="Theme.SplashScreen">
        ...
        <item name="windowSplashScreenAnimatedIcon">@drawable/launch_transparent</item>
		...
    </style>

styles에 Splash 화면 테마를 적용하는 법은 공식문서 -> 스플래시 화면 테마를 설정하여 모양 변경
을 참고하였고, windowSplashScreenAnimatedIcon에 만들어둔 launch_transparent.xml을 적용하였습니다.

profile
어떤 것이든 그것이 지닌 특별한 속성이나 가치를 간과해서는 안 된다.

0개의 댓글