Open In App
Related Articles

How to Create Blink Effect on TextView in Android?

Improve Article
Save Article
Like Article

In this article, we are going to implement a very important feature related to TextView. Here we are adding the blink text feature on a TextView. This feature can be used to show important announcements or notifications in an App. Even we can add this feature to show important links for the user. So here we are going to learn how to implement that feature. A sample GIF is given below to get an idea about what we are going to do in this article. Note that we are going to implement this project using the Java language. 

Create Blink Effect on TextView in Android Sample GIF

Step by Step Implementation

Step 1: Create a New Project

To create a new project in Android Studio please refer to How to Create/Start a New Project in Android Studio. Note that select Java as the programming language.

Step 2: Working with the activity_main.xml file

Navigate to the app > res > layout > activity_main.xml and add the below code to that file. Below is the code for the activity_main.xml file. 


<?xml version="1.0" encoding="utf-8"?>
        android:text="Blink Effect"
        android:textSize="30dp" />
        android:text="Blink Text" />

Step 3: Working with the file

Go to the file and refer to the following code. Below is the code for the file. Comments are added inside the code to understand the code in more detail.


import android.animation.ArgbEvaluator;
import android.animation.ObjectAnimator;
import android.os.Bundle;
import android.view.View;
import android.view.animation.Animation;
import android.widget.Button;
import android.widget.TextView;
public class MainActivity extends AppCompatActivity {
    TextView blinkt;
    Button blinkb;
    protected void onCreate(Bundle savedInstanceState) {
        blinkb = findViewById(;
        blinkt = findViewById(;
        blinkb.setOnClickListener(new View.OnClickListener() {
            public void onClick(View v) {
                // adding the color to be shown
                ObjectAnimator animator = ObjectAnimator.ofInt(blinkt, "backgroundColor", Color.BLUE, Color.RED, Color.GREEN);
                // duration of one color
                animator.setEvaluator(new ArgbEvaluator());
                // color will be show in reverse manner
                // It will be repeated up to infinite time


Whether you're preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, GeeksforGeeks Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we've already empowered, and we're here to do the same for you. Don't miss out - check it out now!

Last Updated : 21 Apr, 2021
Like Article
Save Article
Similar Reads
Complete Tutorials