I know the%% class for rectangle and for circle
private Rect retangulo = new Rect();
What is the class to draw circle on Android?
I know the%% class for rectangle and for circle
private Rect retangulo = new Rect();
What is the class to draw circle on Android?
OvalShape
, see documentation . Example:
OvalShape circle = new OvalShape();
circle.resize(50f * mDensity, 50f * mDensity);
Image:
Seesomeapplicationexamplesat Codota for Android .
There is OvalShape
that can be used as a circle too.
I would use this way:
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
OvalShape shape = new OvalShape();
shape.setWidth(10);
shape.setHeight(10);
shape.draw(canvas, paint);
}
An oval that has the same width and height would be a circle.