Java tutorial
//package com.java2s; //License from project: Open Source License import android.annotation.SuppressLint; import android.graphics.drawable.Drawable; import android.os.Build; import android.util.StateSet; import android.view.View; import android.widget.ListView; public class Main { @SuppressLint("NewApi") public static void clearDrawableAnimation(View view) { if (Build.VERSION.SDK_INT < 21 || view == null) { return; } Drawable drawable; if (view instanceof ListView) { drawable = ((ListView) view).getSelector(); if (drawable != null) { drawable.setState(StateSet.NOTHING); } } else { drawable = view.getBackground(); if (drawable != null) { drawable.setState(StateSet.NOTHING); drawable.jumpToCurrentState(); } } } }