Code example for Layout

Methods: draw, getHeight

0
		this.layoutLeft.draw(canvas);
		canvas.restore();
		 
		// draw right text 
		this.getPaint().setColor(!this.isChecked() ? this.textColorChecked : this.textColorUnChecked);
		canvas.translate(left + (this.width / 2 - this.layoutRight.getWidth()) / 2 + this.width / 2, (this.height - this.layoutRight.getHeight()) / 2);
		this.layoutRight.draw(canvas);
		canvas.restore();
	} 
	 
	@Override 
	public int getCompoundPaddingRight ( ) 
	{ 
		int padding = super.getCompoundPaddingRight() + this.width;
		if (!TextUtils.isEmpty(getText()))
			padding += this.switchPadding;
		 
		return padding;
	} 
	 
	@Override