Android examples for Graphics:State List Drawable
Create a selector StateListDrawable drawable
//package com.java2s; import android.graphics.drawable.Drawable; import android.graphics.drawable.StateListDrawable; public class Main { public static StateListDrawable createSelector(Drawable pressed, Drawable normal) {/*from w ww. j av a 2 s . co m*/ StateListDrawable drawable = new StateListDrawable(); drawable.addState(new int[] { android.R.attr.state_pressed }, pressed); drawable.addState(new int[] {}, normal); return drawable; } }