반응형
똑같은 아이콘 이미지 파일 복붙하는데 왜 한 앱에서만 아이콘이 확대돼서 짤려 보이는걸까?
이거는 정말 모르겠다 ㄷㄷㄷ
ios에서는 정상적으로 나오는데 android 스플래쉬 화면 내에 있는 아이콘만 확대돼서 가장자리 부분이 짤리는 이슈가 생겼다.
찾아보니
프로젝트/android/app/src/res/drawable에 따로 스플래쉬 아이콘 파일이 없었는데 추가로 생성해준다.
// /android/app/src/res/drawable/splash_icon.xml
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:drawable="@drawable/splashscreen_logo"
android:width="100dp"
android:height="100dp"
android:gravity="center" />
</layer-list>
이후 프로젝트/android/app/src/res/values/styles.xml
<resources xmlns:tools="http://schemas.android.com/tools">
<style name="AppTheme" parent="Theme.EdgeToEdge">
<item name="android:editTextBackground">@drawable/rn_edit_text_material</item>
<item name="colorPrimary">@color/colorPrimary</item>
<item name="android:statusBarColor">#04DD6A</item>
</style>
<style name="Theme.App.SplashScreen" parent="Theme.SplashScreen">
<item name="windowSplashScreenBackground">@color/splashscreen_background</item>
// 위에 생성한 파일 이름 경로로 변경
<item name="windowSplashScreenAnimatedIcon">@drawable/splash_icon</item>
<item name="postSplashScreenTheme">@style/AppTheme</item>
</style>
</resources>
이렇게 고정값으로 아이콘 크기를 지정해주면 스플래쉬 내 아이콘 크기가 짤리지 않고 잘 보인다. 해결 !
반응형