Skip to main content

Top Android Text Animation Libraries

These are animation libraries you can use to implement text animation in your android app.

(a). TextSurface

TextSurface is a unique animation framework that can be used to display messages in an impressive manner. It can create TextSurface instance and add it in the layout.

Here is the demo:

Installation

TextSurface can be downloaded from its GitHub repository by adding the following under repositories in your root build.gradle:

maven { url "https://jitpack.io" }
``
Then adding the followimh implementation statement in your `dependencies` closure

```groovy
implementation 'com.github.elevenetc:textsurface:0.9.1'

How to use TextSurface?

To create an instance of Text and define its properties such as size, alpha, color, and position, TextBuilder needs to be used, so instantiate and set those properties as shown below:

Text textDaai = TextBuilder
.create("Daai")
.setSize(64)
.setAlpha(0)
.setColor(Color.WHITE)
.setPosition(Align.SURFACE_CENTER).build();

Animations can then be played by creating a sequential or parallel animation based on requirements.

textSurface.play(
new Sequential(
Slide.showFrom(Side.TOP, textDaai, 500),
Delay.duration(500),
Alpha.hide(textDaai, 1500)
)
);

TextSurface is an exciting animation framework that makes messages and information display appealing and interactive. It provides several ways to create animations and offers the flexibility to customize any animation type. You can learn more about TextSurface by visiting https://github.com/elevenetc/textsurface.


(b). HTextView

HTextView is a library that allows you to add animation effects with custom font support to TextView. It is important because it offers a unique and visually appealing feature to regular text, making it perfect for enhancing the aesthetics of your app.

How can I implement HTextView in my app?

To implement HTextView in your app, you need to add the following dependency to your project:

def htextview_version = "0.1.6"
implementation "com.hanks:htextview-base:$htextview_version"
implementation "com.hanks:htextview-fade:$htextview_version"
implementation "com.hanks:htextview-line:$htextview_version"
implementation "com.hanks:htextview-rainbow:$htextview_version"
implementation "com.hanks:htextview-typer:$htextview_version"
implementation "com.hanks:htextview-scale:$htextview_version"
implementation "com.hanks:htextview-evaporate:$htextview_version"
implementation "com.hanks:htextview-fall:$htextview_version"

Next, add the desired TextView animation effect to your layout file by specifying the appropriate class. For example, to use the line effect:

<com.hanks.htextview.line.LineTextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="right"
android:paddingRight="10dp"
android:text="This is LineTextView\nToday is Monday"
android:textSize="16sp"
app:animationDuration="3000"
app:lineColor="#1367bc"
app:lineWidth="4dp"/>

The above code will give you the following:

Some of the available animation effects in HTextView include:

  • Line
  • Fade
  • Typer
  • Rainbow
  • Scale
  • Evaporate
  • Fall

Each effect offers a unique visual and interactive experience for your TextView. You can view their demos here.

This is a library for enhancing the aesthetics of your app and making your text more visually appealing to users. With its various animation effects and custom font support, it offers a unique and interactive experience that can make your app stand out. To learn more about HTextView, visit https://github.com/hanks-zyh/htextview.


(c). Ticker

A Simple Android UI Component for Displaying Scrolling Text

Ticker is a simple Android UI component used for displaying scrolling text. It handles smooth animations between strings and string resizing.

It works like an odometer that scrolls from one number to the next. You can specify how the animations proceed by defining an array of characters in order, controlling which characters are displayed.

Usage

To use Ticker 2.0, add the ticker dependency by including:

 implementation 'com.robinhood.ticker:ticker:2.0.4

in your build.gradle file. Then define the TickerView in XML:

<com.robinhood.ticker.TickerView
android:id="@+id/tickerView"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />

Afte that add the character array to specify the animation style:

final TickerView tickerView = findViewById(R.id.tickerView);
tickerView.setCharacterLists(TickerUtils.provideNumberList());

This is a great way to display scrolling text in Android UI. It handles smooth animations and string resizing while providing customization options via XML or Java. The performance is great and it is licensed under the Apache License, Version 2.0. For more information, please refer to the Ticker documentation at the following URL: here.


(d). FadingTextView

A TextView that changes its content automatically every few seconds.

FadingTextView is a library that makes TextView change its text content automatically one after the other every few seconds.

Here is the demo:

How do I use it in my app?

First, you need to add the JitPack repository to your root build.gradle file. Then, add the library dependency to your app module.

dependencies {
implementation 'com.github.rosenpin:fading-text-view:3.0'
}

After that, create a string-array in your values folder:

<string-array name="examples">
<item>Hello</item>
<item>Fading TextView</item>
</string-array>

Then add the FadingTextView to your layout, and set the texts attribute to the name of the string-array:

<com.tomer.fadingtextview.FadingTextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:texts="@array/examples" />

You can also customize the display timeout for each text and update the view dynamically.

app:timeout="500"

Can I update the view dynamically?

Yes, you can set the text dynamically by using the setTexts() method and passing it an array of strings.

String[] texts = {"text1","text2","text3"};
FadingTextView FTV = (FadingTextView) findViewById(R.id.fadingTextView);
FTV.setTexts(texts); //You can use an array res

You can also set the timeout between text changes using the setTimeout() method.

//For text change once every hour
FTV.setTimeout(60, MINUTES);
//For text change once every half a minute
FTV.setTimeout(0.5, MINUTES);
//For text change every 10 seconds
FTV.setTimeout(10, SECONDS);
//For text change every 500 milliseconds (0.5 seconds)
FTV.setTimeout(500, MILLISECONDS);

How do I randomize the order of the strings?

You can shuffle the order by using the shuffle() method. Note that you will need to run this method after each time you update the view.

FTV.setTexts(texts);
FTV.shuffle();

FadingTextView is licensed under the Apache License, Version 2.0. For more information, please refer to the license file in the library. To learn more about FadingTextView, visit the library's page on github.


(d). RollingTextView

An Animated Text View Library

RollingTextView is a library for Android application developers that allows them to animate textviews with rolling effects. The setText method can be animated with up and down rolling.

XML can be used to set up common properties such as android:textSize, android:textColor, android:textStyle, android:gravity, android:shadowColor, android:shadowDx, android:shadowDy, and android:shadowRadius.

The animation effects of any single character can be highly customized, and any different rolling effect can be achieved by setting different animation strategies.

The default animation strategy is to roll down when small characters change to large characters, and vice versa. You can also specify rolling in the same direction. The carry animation can be worked from low digit to high digit and not only for decimal. But it can only be used for strings with a length less than 10 to prevent integer from overflow. It can only be used for a sequence of characters containing 0, otherwise the calculation of the carry will be meaningless.

How to use it in an Android project?

This library can be added to a project by using the following code in your build.gradle file:

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

dependencies {
implementation "com.github.YvesCheung.RollingText:RollingText:x.y.z"
}

How to use it

First add to your layout:

<com.yy.mobile.rollingtextview.RollingTextView
android:id="@+id/alphaBetView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="i am text"
android:textSize="25sp"
android:textColor="#1d1d1d"
android:textStyle="bold"
android:gravity="center"
android:shadowColor="#ff44ffdd"
android:shadowDx="10"
android:shadowDy="10"
android:shadowRadius="10"/>

Then write code:

final RollingTextView rollingTextView = findViewById(R.id.alphaBetView);
rollingTextView.setAnimationDuration(2000L);
rollingTextView.setCharStrategy(Strategy.NormalAnimation);
rollingTextView.addCharOrder(CharOrder.Alphabet);
rollingTextView.setAnimationInterpolator(new AccelerateDecelerateInterpolator());
rollingTextView.addAnimatorListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
//finsih
}
});
rollingTextView.setText("i am a text");

The library is licensed under the Apache license and is highly recommended for developers seeking to add unique and animated text effects to their applications.

URL to learn more: https://github.com/YvesCheung/RollingText