Code example for StateListDrawable

Methods: addState

0
		else { 
			textView.setPadding(0, 0, 0, 0);
		} 
		 
		if(backgroundVisible) {
			StateListDrawable state = new StateListDrawable();
			state.addState(new int[]{R.attr.state_enabled}, makeEnabledBackgroundDrawable());
			state.addState(new int[]{-R.attr.state_enabled}, makeDisabledBackgroundDrawable());
			setBackgroundDrawable(state);
		} 
		 
		addView(textView);
			 
		setOnClickListener(onClickListener);
	} 
	 
	protected Drawable makeEnabledBackgroundDrawable() {
		int bottom = colors.getColor(bottomColor);
		int top = colors.getColor(topColor);
		int strokeTop = colors.getColor(strokeTopColor);
Connect your IDE to all the code out there  Get Codota for Java