Code example for StateListDrawable

Methods: addState

0
            mShelfBackground = shelfBackground;
        } 
    } 
 
    private void init(Context context) {
        StateListDrawable drawable = new StateListDrawable();
 
        SpotlightDrawable start = new SpotlightDrawable(context, this);
        start.disableOffset();
        SpotlightDrawable end = new SpotlightDrawable(context, this, 0);
        end.disableOffset();
        TransitionDrawable transition = new TransitionDrawable(start, end);
        drawable.addState(new int[] { android.R.attr.state_pressed },
                transition);
 
        final SpotlightDrawable normal = new SpotlightDrawable(context, this);
        drawable.addState(new int[] { }, normal);
 
        normal.setParent(drawable);
        transition.setParent(drawable);
 
        setSelector(drawable);
        setDrawSelectorOnTop(false);
    } 
 
Stop searching for code, let great code find you!  Add Codota to your java IDE