Last active
September 20, 2015 13:17
-
-
Save wowiwo1/327ba968ef278fc0bce7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class MainActivity extends Activity { | |
@Override | |
protected void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
setContentView(new MainView(this)); | |
} | |
private class MainView extends View { | |
public MainView(Context context) { | |
super(context); | |
} | |
@Override | |
protected void onDraw(Canvas canvas) { | |
super.onDraw(canvas); | |
canvas.drawColor(Color.WHITE); | |
Paint paint = new Paint(); | |
paint.setColor(Color.RED); | |
canvas.drawCircle( | |
canvas.getWidth()/2, | |
canvas.getHeight()/4, | |
canvas.getHeight()/10, | |
paint); | |
paint.setColor(Color.GREEN); | |
paint.setStyle(Paint.Style.STROKE); | |
canvas.drawRect( | |
canvas.getWidth()/2 - canvas.getHeight()/10, | |
canvas.getHeight()*2/4 - canvas.getHeight()/10, | |
canvas.getWidth()/2 + canvas.getHeight()/10, | |
canvas.getHeight()*2/4 + canvas.getHeight()/10, | |
paint); | |
paint.setColor(Color.BLUE); | |
paint.setStyle(Paint.Style.FILL); | |
paint.setAntiAlias(true); | |
canvas.drawCircle(canvas.getWidth()/2, | |
canvas.getHeight()*3/4, | |
canvas.getHeight()/10, | |
paint); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment