Code example for RectShape

0
        init(); 
    } 
 
    private void init() 
    { 
        drawable = new ShapeDrawable(new RectShape());
        drawable.setBounds(0,0, 50, 50);
    } 
 
    @Override 
    protected void onDraw(Canvas canvas)
    { 
        if (drawable != null)
            drawable.draw(canvas);
    } 
 
    public int getColor() 
    { 
        return drawable.getPaint().getColor();
    } 
Experience pair programming with AI  Get Codota for Java