List of usage examples for android.graphics.drawable StateListDrawable setEnterFadeDuration
public void setEnterFadeDuration(int ms)
From source file:com.flexible.flexibleadapter.utils.DrawableUtils.java
private static StateListDrawable getStateListDrawable(@ColorInt int normalColor, @ColorInt int pressedColor) { StateListDrawable states = new StateListDrawable(); states.addState(new int[] { android.R.attr.state_activated }, getColorDrawable(pressedColor)); states.addState(new int[] {}, getColorDrawable(normalColor)); // Animating across states. // It seems item background is lost on scrolling out of the screen, 21 <= API <= 23 if (!Utils.hasLollipop() || Utils.hasNougat()) { int duration = 200; //android.R.integer.config_shortAnimTime states.setEnterFadeDuration(duration); states.setExitFadeDuration(duration); }/* w ww. jav a 2 s . c o m*/ return states; }