Lottie 라이브러리를 사용해보자

2019. 5. 10. 23:15기타

안녕하세요 오늘은 airbnb의 Lottie 라이브러리를 사용해 보려고 합니다.

 

시작하기 전에 아래의 사이트에서 원하는 애니메이션 이미지를 선택해서 다운받아주세요

 

Lottie Json Sample : https://lottiefiles.com

 

LottieFiles - Free animation files build for Lottie, Bodymovin

LottieFiles is a collection of animations designed for Lottie and Bodymovin - gone are the days of bugging your developer

lottiefiles.com

프로젝트를 생성한 후 assets 폴더를 생성해 줍니다.

 

assets 생성 밥법은 우클릭 -> New -> Folder -> Assets Folder 순으로 진행하시면 됩니다.

 

완성된 Asstes Folder에 .json 파일을 아래와 같이 복사해서 넣어줍니다.

 

저의 경우 icecream.json 파일입니다.

 

 

app수준 build.gradle의 dependencies에 추가합니다.

 

 

여기서 java 와 xml 두 가지 방법이 있습니다.

 

xml code

 

 

java code