1. build.gradle(Module: app)에 implementation 추가

2. xml 작성

 


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

 

ybq/Android-SpinKit

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

github.com

위 링크를 통해 들어가시면 제작자분이 만든 여러 스피너 예제들을 확인하실 수 있습니다.

 

 

1. build.gradle(Module: app)에 implementation 추가

implementation 'com.github.ybq:Android-SpinKit:1.4.0'

 

2. xml 작성

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="#8986F1"
    android:gravity="center"
    tools:context=".MainActivity">

    <com.github.ybq.android.spinkit.SpinKitView
        xmlns:app="http://schemas.android.com/apk/res-auto"
        android:id="@+id/spin_kit"
        style="@style/SpinKitView.Large.CubeGrid"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center"
        app:SpinKit_Color="#36B2C2" />

</LinearLayout>

SpinKitView의 style에 원하는 형태의 이름을 넣어주시면 됩니다.

Large, Small을 이용해서 크기도 변경 가능합니다.

 

 


간혹 에러가 발생하는데

제 경우에는 버전이 맞지않아서

build.gradle(Project: ) - dependencies 내부 classpath 버전을

classpath 'com.android.tools.build:gradle:3.4.1'

이렇게 바꿔주니 정상 실행되었습니다.


+ Recent posts