How to compare all nine Android interpolators firsthand

William J. Francis revisits the topic of Android interpolators and shows how you can have even more fun with these classes.


I wrote an article in November 2013 on using Android's bounce interpolator. Since then, I have received several emails asking about the other eight interpolators supported by Android's SDK. Rather than going through them one at a time, I thought it would be handy just to write an app that allowed a user to play with them all.

This quick project allows you to compare the various interpolators provided by Android firsthand. You can follow along, or download and import the entire project directly into Eclipse.

1. Create a new Android project in Eclipse. Target SDK 14 (ICS) or better.

2. In the /res/values folder, hardcode an array in the string.xml file.

<?xml version="1.0" encoding="utf-8"?>

    <string name="app_name">FunWithText</string>
    <string name="action_settings">Settings</string>
    <string name="hello_world">Hello World</string>
    <string name="prompt">Pick One</string>
    <string-array name="interpolators">


3. Our layout will consist of a Text View and a Spinner. Find the /res/layout/activity_main.xml file and make the following modifications.

<RelativeLayout xmlns:android=""

        android:text="@string/hello_world" />
        android:prompt="@string/prompt" />


4. We will need to code up our /src/ file. Here I am wiring up an OnItemSelected listener to our spinner widget, and using a bit of reflection to create the correct interpolator. I know some Java purists will be quick to point out that Class.forName().newInstance() is not the recommended way to load a class via reflection; however, it is very convenient for the context of what I am doing here, and realistically a production application would be choosing just one or maybe a few concrete implementations of very specific interpolators.
package com.authorwjf.funwithtext;

import android.os.Bundle;
import android.view.Display;
import android.view.View;
import android.view.animation.Interpolator;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemSelectedListener;
import android.widget.Spinner;
import android.widget.TextView;

public class MainActivity extends Activity implements OnItemSelectedListener {
	private static final long DELAY = 1000;
	private static final long DURATION = 500;
	private static final String PACKAGE = "android.view.animation.";
	private TextView mTextView1;
	private float getScreenHeight() {
		Display display = getWindowManager().getDefaultDisplay();
		Point size = new Point();
		return (float) size.y;
	protected void onCreate(Bundle savedInstanceState) {
		mTextView1 = (TextView) findViewById(;

	public void onItemSelected(AdapterView<?> parent, View view, int pos,long id) {
		String interpolatorName = (String) parent.getAdapter().getItem(pos);
		try {
			Interpolator interpolator = (Interpolator) Class.forName(PACKAGE+interpolatorName).newInstance();
		} catch (Exception e) {

	public void onNothingSelected(AdapterView<?> arg0) {
		// TODO Auto-generated method stub


Ready to see some view animations in action? Run the app (preferably on a device) and select an interpolator from the drop-down. Each time you do, the "hello world" text will drop out of sight and then animate back into the view. You may need to slow the animation duration down to get a good idea of the differences between some of the more subtle animations.

I encourage you to sprinkle view animations throughout your app when possible. I find view animations are very useful for pointing out touchable areas on the screen, as well as smoothing over the lag when I'm performing background computations.

Also see

By William J. Francis

William J Francis began programming computers at age eleven. Specializing in embedded and mobile platforms, he has more than 20 years of professional software engineering under his belt, including a four year stint in the US Army's Military Intellige...