Skip to content

Instantly share code, notes, and snippets.

@TakuSemba
Created August 8, 2017 09:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save TakuSemba/8cc2af8ab515e75e160ecab72353f27f to your computer and use it in GitHub Desktop.
Save TakuSemba/8cc2af8ab515e75e160ecab72353f27f to your computer and use it in GitHub Desktop.
public class CanvasView extends View {
private Paint paint = new Paint();
public CanvasView(Context context) {
super(context);
}
public CanvasView(Context context, @Nullable AttributeSet attrs) {
super(context, attrs);
}
public CanvasView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
}
@Override
public void draw(Canvas canvas) {
super.draw(canvas);
paint.setStyle(Paint.Style.FILL);
canvas.drawCircle(getRootView().getWidth() / 2, getRootView().getHeight() / 2, 50, paint);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment