Android/Android

[Android] 앱 로고 (앱 아이콘) 생성하기

핀수 2022. 4. 18. 01:32
728x90
반응형

해당 글을 참고하여 작성하였습니다

 

안드로이드 Adaptive icon 적용하기

“이 포스트는 2018년 1월 원티드 제품블로그 글을 재구성한 내용입니다.”

medium.com

 

drawable > new > Image Asset

 

mipmap-anydpi-v26/ic_launcher_img.xml

<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
    <background android:drawable="@color/ic_launcher_img_background"/>
    <foreground android:drawable="@mipmap/ic_launcher_img_foreground"/>
</adaptive-icon>

anydpi-v26 폴더에는 foreground, background 가 정의된 vector 리소스가 추가된다.

  • anydpi-v26 : 26버전부터 지원하고, 어느 dpi에 상관없이 동작이 가능함을 의미
    • foreground, background 두 개의 VectorDrawable 리소스 생성
    • 생성된 리소스 중 서비스 정책에 맞는 리소스를 그대로 사용하면 된다.

 

background 리소스의 경우 Asset Type 을 Color, Image 형태로 선택 가능

컬러를 선택할 경우 ic_launcher_background.xml 은

value 폴더에 컬러 리소스를 가지고 있는 파일로 생성됨 (아래와 같이)

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <color name="ic_app_main_logo_background">#FFFFFF</color>
</resources>

 

이미지를 선택할 경우 drawable xml이 생성됨

생성을 하고 나면 자동으로 icon 과 roundicon 이 생성되는 것을 알 수 있다.

roundIcon은 API 25부터 추가 되었다.

Launcher 에서는 roundIcon 속성을 지원하며, application 에 해당 값이 설정 되어 있을 경우에만

roundIcon 을 사용한다.

 

 

TroubleShooting

자꾸만 foreground 파일을 찾을 수 없다는 에러가 떠서 이해할 수 없었는데

맞는 이름을 찾아서 바꿔주니까 해결되었다.

(내가 디폴트 값인 ic_launcher 에서 이름을 바꿔버리고 좀..난잡하게 해서 발생한 문제같다)

다음부터는 그냥 덮어쓰는게 제일 좋을 것 같다.

728x90
반응형