Skip to content

Instantly share code, notes, and snippets.

@masarugen
Created May 27, 2015 00:20
Show Gist options
  • Save masarugen/1f7361e7cc1ecae818a2 to your computer and use it in GitHub Desktop.
Save masarugen/1f7361e7cc1ecae818a2 to your computer and use it in GitHub Desktop.
public class AlphaImageView extends ImageView {
private static final int FADE_IN_TIME_MS = 10000;
public AlphaImageView(Context context) {
super(context);
}
public AlphaImageView(Context context, AttributeSet attrs) {
super(context, attrs);
}
public AlphaImageView(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
}
@Override
public void setImageBitmap(Bitmap bm) {
AlphaAnimation fadeIn = new AlphaAnimation(0, 1);
fadeIn.setDuration(FADE_IN_TIME_MS);
fadeIn.setInterpolator(new LinearInterpolator());
super.setImageBitmap(bm);
startAnimation(fadeIn);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment