Install Android-SpinKit via Gradle
masterAdd the following dependency to your app's build.gradle file to include Android-SpinKit in your project.
dependencies {
implementation 'com.github.ybq:Android-SpinKit:1.4.0'
}repository·master·Indexed 27 days ago
https://github.com/ybq/android-spinkitA library providing various loading animations for Android applications, inspired by the SpinKit web project. It includes the SpinKitView component for XML layouts and support for using animations like DoubleBounce, Wave, and RotatingPlane as indeterminate drawables for standard Android ProgressBars.
Add the following dependency to your app's build.gradle file to include Android-SpinKit in your project.
dependencies {
implementation 'com.github.ybq:Android-SpinKit:1.4.0'
}You can add loading animations directly to your XML layouts using the SpinKitView component. Use the style attribute to select the animation type and app:SpinKit_Color to set the animation color.
<com.github.ybq.android.spinkit.SpinKitView
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/spin_kit"
style="@style/SpinKitView.Large.Circle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
app:SpinKit_Color="@color/colorAccent" />To use a SpinKit animation with a standard Android ProgressBar, instantiate the desired animation class and set it as the indeterminate drawable using setIndeterminateDrawable().
ProgressBar progressBar = (ProgressBar)findViewById(R.id.progress);
DoubleBounce doubleBounce = new DoubleBounce();
progressBar.setIndeterminateDrawable(doubleBounce);To use a SpinKit animation with a standard Android ProgressBar, instantiate a Sprite (such as DoubleBounce) and set it as the indeterminate drawable of the progress bar.
ProgressBar progressBar = (ProgressBar)findViewById(R.id.progress);
Sprite doubleBounce = new DoubleBounce();
progressBar.setIndeterminateDrawable(doubleBounce);The following animation styles are available for use in SpinKitView (via styles) or as drawable objects:
RotatingPlaneDoubleBounceWaveWanderingCubesPulseChasingDotsThreeBounceCircleCubeGridFadingCircleFoldingCubeRotatingCircleAndroid-SpinKit provides several predefined styles that can be applied to SpinKitView. These styles control both the animation type and the size (e.g., .Large, .Small).
Available Animation Types:
RotatingPlaneDoubleBounceWaveWanderingCubesPulseChasingDotsThreeBounceCircleCubeGridFadingCircleFoldingCubeRotatingCircleBase Styles:
@style/SpinKitView@style/SpinKitView.Circle@style/SpinKitView.Large@style/SpinKitView.Small@style/SpinKitView.Small.DoubleBounce