Another useful extension of the Drawable class is the ShapeDrawable, which allows us to define basic geometrical shapes such as arcs, ovals, and rounded rectangles. ShapeDrawables are often used alongside the Paint class which provides a way of applying drawing styles. A common way to achieve this is by extending the View class and overriding its onDraw()
callback.
Everything that is done in this task is generated by the system and there is no need to import any graphic file. Simply start a new Android project in Eclipse and open the Java editor on the Activity file.
Within our main Activity, create a new inner class that extends View as follows:
public class MyShape extends View { private final ShapeDrawable mShape; }
Give the new class the constructor shown here:
public MyShape(Context context) { super(context); Paint paint = new Paint(); paint.setARGB(255, 255, 255, 0); paint.setStyle(Paint.Style.STROKE)...