Skip to content

Nitish33/AnimatedTextExample

Repository files navigation

This is a simple example for AnimatedTextView library.

Above gif show typo effect

Setup

App jitpakc repository in your root build.gradle at the end of repositories


allprojects {
		repositories {
			...
			maven { url 'https://jitpack.io' }
		}
	}
 
 

Add the dependency

 
 dependencies {
	       implementation 'com.github.Nitish33:AnimatedText:v1.0'
	}
 
 

XML

Simple Example

	
<devnitish.com.animatedtext.AnimatedTextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
/>

Not triggering animation on start

Property : autoState = 'false'

	
<devnitish.com.animatedtext.AnimatedTextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:autoStart="false"
/>

Controlling Animation Speed

You can control the speed of animation using animInterval
animInterval - Time delay between two character
	
<devnitish.com.animatedtext.AnimatedTextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:animInterval="500"
/>

Java

Java Provides more flexibility and effects on the textview.

Starting Animation In Java


  animatedTextView.animateText();
  
  

Above Line start a simple typo animation.

If you have multiple lines and and want to show different delay and speed typo animation. You can do it with overloaded animateText();

#1Function Signature


    public void animateText(final ArrayList allString,
                             final ArrayList allSpeed)

allString

This parameter store all the string which you want to show.

AllSpeed

This parameter store the timedelay between two two alphabet

Usage


 
        ArrayList allString = new ArrayList<>();
//        allString.add("N");
        allString.add("Nitish");
        allString.add(" Prasad");
        allString.add("How are you.What are you doing.");
        allString.add("This is a simple Library");
        allString.add("To Show Typo Effect on the text view");
        allString.add("I will add more effect");
        allString.add("in the library with time.");


        ArrayList allInteger = new ArrayList<>();
//        allInteger.add(50);
        allInteger.add(50);
        allInteger.add(50);
        allInteger.add(50);
        allInteger.add(50);
        allInteger.add(50);
        allInteger.add(50);
        allInteger.add(50);
        
        textView.animateText(allString,allInteger);
 
 
 

#2Function Signature


    public void animateText(final ArrayList allString,
                             final ArrayList allSpeed,
                             final ArrayList allDelay)

allDelay

If you want some pause between to string you can specify delay in this parameter.

Usage


 
        ArrayList allString = new ArrayList<>();
//        allString.add("N");
        allString.add("Nitish");
        allString.add(" Prasad");
        allString.add("How are you.What are you doing.");
        allString.add("This is a simple Library");
        allString.add("To Show Typo Effect on the text view");
        allString.add("I will add more effect");
        allString.add("in the library with time.");


        ArrayList allInteger = new ArrayList<>();
//        allInteger.add(50);
        allInteger.add(50);
        allInteger.add(50);
        allInteger.add(50);
        allInteger.add(50);
        allInteger.add(50);
        allInteger.add(50);
        allInteger.add(50);
        
        ArrayList allDelays = new ArrayList<>();
//        allDelays.add(1000);
        allDelays.add(100);
        allDelays.add(100);
        allDelays.add(100);
        allDelays.add(500);
        allDelays.add(10);
        allDelays.add(500);
        allDelays.add(10);
        
        textView.animateText(allString,allInteger,allDelays);
 
 
 

#3Function Signature


    public void animateText(final ArrayList allString,
                             final ArrayList allSpeed,
                             final ArrayList allDelay,
                             final boolean overlap)

overlap

If you want to show animation in which previous string is removed which writting new string , than you can use this function alternative.

Usage


 
        ArrayList allString = new ArrayList<>();
//        allString.add("N");
        allString.add("Nitish");
        allString.add(" Prasad");
        allString.add("How are you.What are you doing.");
        allString.add("This is a simple Library");
        allString.add("To Show Typo Effect on the text view");
        allString.add("I will add more effect");
        allString.add("in the library with time.");


        ArrayList allInteger = new ArrayList<>();
//        allInteger.add(50);
        allInteger.add(50);
        allInteger.add(50);
        allInteger.add(50);
        allInteger.add(50);
        allInteger.add(50);
        allInteger.add(50);
        allInteger.add(50);
        
        ArrayList allDelays = new ArrayList<>();
//        allDelays.add(1000);
        allDelays.add(100);
        allDelays.add(100);
        allDelays.add(100);
        allDelays.add(500);
        allDelays.add(10);
        allDelays.add(500);
        allDelays.add(10);
        
        textView.animateText(allString,allInteger,allDelays,true);
 
 
 

About

This is example of textview animation which i am developing.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages