Java tutorial
//package com.java2s; import android.graphics.drawable.ColorDrawable; import android.graphics.drawable.StateListDrawable; public class Main { /** * helper to create a StateListDrawable for the drawer item background * * @param selected_color * @return */ public static StateListDrawable getDrawerItemBackground(int selected_color) { ColorDrawable clrActive = new ColorDrawable(selected_color); StateListDrawable states = new StateListDrawable(); states.addState(new int[] { android.R.attr.state_selected }, clrActive); return states; } }