Code example for RoundRectShape

0
	   
	public ButtonView(Context c){
		super(c);
		 float[] outerR = new float[] { 12, 12, 12, 12, 12, 12, 12, 12 };
		 mDrawable = new ShapeDrawable(new RoundRectShape(outerR, null,
                 null)); 
	     mDrawable.getPaint().setColor(0xff74AC23);
	     mDrawable.getPaint().setShader(makeLinear());
	} 
	 
	@Override  
	protected void onDraw(Canvas canvas) {
 
		 
		mDrawable.setBounds(x, y, x + width, y + height);
		mDrawable.draw(canvas);
	} 
}