/ Loading

A custom loading spinner for android

A custom loading spinner for android

KLoadingSpin

A custom loading spinner for android.

KLoadingSpin

Gradle Dependency

  • Add jitpack to your project
allprojects {
		repositories {
			...
			maven { url 'https://jitpack.io' }
		}
	}
  • Add the dependency
dependencies {
    implementation 'com.github.Nikoloutsos:KLoadingSpin:1.0.0'
 }

Usage

  • Add it in your xml and make it fill the entire screen.
<com.example.kloadingspin.KLoadingSpin
       android:id="@+id/KLoadingSpin"
       android:layout_width="match_parent"
       android:layout_height="match_parent"
       app:backgroundColor="#55008DFF"
       app:primarySpinnerColor="#ffffff"
       app:rotationSpeedInMs="3000"
       app:text="Searching for the best \n donut for you..."
       app:secondarySpinnerColor="#FF9800"
       app:textColor="#ffffff"
       app:textSize="80" />
  • Run the following code to show/hide
  // For showing
  KLoadingSpin a = findViewById(R.id.loading);
  a.startAnimation();
      a.setIsVisible(true);
  
  // For hiding
  KLoadingSpin a = findViewById(R.id.loading);
  a.stopAnimation()
  

Customize

xml attribute description
app:backgroundColor The color of the background (don't forget to use alpha)
e.g #40FF0000 not #FF0000
app:primarySpinnerColor The color of the spinning circle(The one with curcular motion)
app:secondarySpinnerColor The color of the spinning circle(The oposite of primarySpinnerColor )
app:rotationSpeedInMs The time in milliseconds for 1 full cycle animation
app:text The text that will be displayed under the loading animation
app:textColor The color of the text
app:textSize The size of the text (Recommended size: 70)

GitHub