Here you can find the source of bgColorDrawableSelector(Bitmap nomal, Bitmap focus)
public static StateListDrawable bgColorDrawableSelector(Bitmap nomal, Bitmap focus)
//package com.java2s; //License from project: LGPL import android.graphics.Bitmap; import android.graphics.drawable.BitmapDrawable; import android.graphics.drawable.StateListDrawable; public class Main { public static StateListDrawable bgColorDrawableSelector(Bitmap nomal, Bitmap focus) {/*from www. j a v a 2s . c o m*/ BitmapDrawable nomalBitmap = new BitmapDrawable(nomal); BitmapDrawable focusBitmap = new BitmapDrawable(focus); StateListDrawable selector = new StateListDrawable(); selector.addState(new int[] { android.R.attr.state_pressed }, focusBitmap); selector.addState(new int[] { android.R.attr.state_selected }, focusBitmap); selector.addState(new int[] { android.R.attr.state_focused }, focusBitmap); selector.addState(new int[] {}, nomalBitmap); return selector; } }