KLoadingSpin

Additional

Language
Java
Version
1.1.0 (Sep 22, 2019)
Created
Aug 24, 2019
Updated
Jun 8, 2020 (Retired)
Owner
Konstantinos Nikoloutsos (Nikoloutsos)
Contributor
Konstantinos Nikoloutsos (Nikoloutsos)
1
Activity
Badge
Generate
Download
Source code

Advertisement

Preview

Gradle Dependency

  • Add jitpack to your project
allprojects {
  repositories {
   ...
   maven { url 'https://jitpack.io' }
  }
 }
  • Add the dependency
dependencies {
    implementation 'com.github.Nikoloutsos:KLoadingSpin:1.1.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.KLoadingSpin);
  a.startAnimation();
      a.setIsVisible(true);
  
  // For hiding
  KLoadingSpin a = findViewById(R.id.KLoadingSpin);
  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)