Java tutorial
//package com.java2s; import android.graphics.drawable.Drawable; import android.graphics.drawable.StateListDrawable; public class Main { public static StateListDrawable getDrawable(Drawable normal, Drawable pressed) { StateListDrawable sd = new StateListDrawable(); sd.addState(new int[] { android.R.attr.state_pressed }, pressed); sd.addState(new int[] { android.R.attr.state_enabled }, normal); sd.addState(new int[] {}, pressed); return sd; } }