Code example for ColorStateList

Methods: getDefaultColor

0
	protected void init(Context context) {
		super.init(context);
		if(mLinePaint == null){
			ColorStateList colors = getTextColors();
			mLinePaint = new Paint();
			mLinePaint.setColor(colors.getDefaultColor());
			mLinePaint.setStrokeWidth(2);
		} 
	} 
 
	@Override 
	public void draw(Canvas canvas) {
		super.draw(canvas);
		 
		canvas.drawLine(0, getHeight()-1, getWidth(), getHeight()-1, mLinePaint);
	} 
}