[Android] 스피너(Android-SpinKit) 사용하기
2020. 5. 23. 23:01
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'
이렇게 바꿔주니 정상 실행되었습니다.
'안드로이드 > Android' 카테고리의 다른 글
[Android] 로그캣(Logcat)을 이용한 로그 출력 (0) | 2020.05.25 |
---|---|
[Android] 액티비티 생명주기 (0) | 2020.05.24 |
[Android] 오픈소스 UI 사용하기 (0) | 2020.05.22 |
[Android] Jsoup 웹크롤링 http 사이트 연결방법 (0) | 2020.04.22 |
[Android] Jsoup을 이용해 fragment에서 웹크롤링하기 (1) | 2020.04.22 |