Java tutorial
//package com.java2s; //License from project: Open Source License import android.graphics.drawable.ColorDrawable; import android.graphics.drawable.Drawable; import android.graphics.drawable.TransitionDrawable; public class Main { @SuppressWarnings("ResourceType") public static TransitionDrawable drawable2TransitionDrawable(Drawable drawable) { TransitionDrawable mBitmapDrawable = null; try { if (drawable == null) { return null; } mBitmapDrawable = new TransitionDrawable( new Drawable[] { new ColorDrawable(android.R.color.transparent), drawable }); } catch (Exception e) { e.printStackTrace(); } return mBitmapDrawable; } }