Create a MyView class with this code:
package it372.drawing1;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.view.View;
public class MyView extends View {
public MyView(Context context) {
super(context);
}
@Override
public void onDraw(Canvas canvas) {
Paint paint = new Paint( );
canvas.drawColor(
Color.parseColor("#ffa0a0"));
paint.setColor(Color.BLUE);
canvas.drawCircle(100, 100, 50, paint);
paint.setStrokeWidth(10);
System.out.println(canvas.getWidth());
System.out.println(canvas.getHeight());
canvas.drawLine(150, 150, 300, 300, paint);
paint.setTextSize(50.0f);
paint.setColor(Color.WHITE);
canvas.drawText("Test Drawing", 200, 100, paint);
}
}