Code example for ShapeDrawable

Methods: setBounds, getPaint

0
        Shape shape;
 
        shape = new OvalShape();
        shape.resize(50, 50);
 
        myShapeDrawable = new ShapeDrawable(shape);
        myShapeDrawable.getPaint().set(paint);
        myShapeDrawable.setBounds(125, 225, 275, 375);
 
        setContentView(new MyView(this));
    } 
 
    /* Our custom view which will draw the drawable */ 
    private class MyView extends View {
 
        public MyView(Context context) {
            super(context);
        } 
 
        @Override 
        protected void onDraw(Canvas canvas) {