Android App

loadingAnimation (SpinKit) in Android Studio

YunSeong 2021. 8. 23. 15:37
728x90
반응형

https://youtu.be/M44Bcs-_9D0

https://github.com/ybq/Android-SpinKit

 

GitHub - ybq/Android-SpinKit: Android loading animations

Android loading animations. Contribute to ybq/Android-SpinKit development by creating an account on GitHub.

github.com

 

위와 같이 사람들이 만들어놓은 라이브러리 등을 github에서 찾아서 사용하면 편하게 더 퀄리티 높은 앱을 만들 수 있다.

밑 링크에서 license에 관한 더 자세한 정보를 얻을 수 있다.

https://olis.or.kr/license/licenseOSI.do?page=1 

 

라이선스 분류

 

olis.or.kr

 


1. build.gradle (:app)

1
2
3
4
5
            ...
dependencies {
            ...
    implementation 'com.github.ybq:Android-SpinKit:1.4.0'
}
cs

위와 같이 라이브러리를 추가해준다.

 


2. activity_main.xml

1
2
3
4
5
6
7
8
9
10
11
12
13
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
            ...
    android:background="#673AB7"
    android:gravity="center">
    <com.github.ybq.android.spinkit.SpinKitView
        xmlns:app="http://schemas.android.com/apk/res-auto"
        android:id="@+id/spin_kit_1"
        style="@style/SpinKitView.Large.FoldingCube"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        app:SpinKit_Color="#00BCD4" />
</LinearLayout>
cs

6~12 - 위와 같은 형태로 로딩 애니메이션을 넣을 수 있다.

원하는 종류에 따라서 아래와 같이 style 속성을 설정해주면 된다.

@style/SpinKitView

@style/SpinKitView.Circle

@style/SpinKitView.Large

@style/SpinKitView.Small

@style/SpinKitView.Small.DoubleBounce

 


3. 결과

 

그렇게 하면 이런 애니메이션을 쉽게 앱에 가져올 수 있다.

 

728x90
반응형