Skip to content

Instantly share code, notes, and snippets.

@StrixG
Created February 12, 2016 17:22
Show Gist options
  • Save StrixG/200684a4e0c0956fbe15 to your computer and use it in GitHub Desktop.
Save StrixG/200684a4e0c0956fbe15 to your computer and use it in GitHub Desktop.
rect
@Override
protected void onDraw(Canvas canvas) {
canvas.drawColor(Color.BLACK);
Paint paint = new Paint();
paint.setStyle(Paint.Style.FILL);
for (int i = 1; i < 5; i ++) {
Log.d("MyView", "onDraw " + Integer.toString(i));
switch (i) {
case 1: {
paint.setColor(Color.BLUE);
break;
}
case 2: {
paint.setColor(Color.RED);
break;
}
case 3: {
paint.setColor(Color.WHITE);
break;
}
case 4: {
paint.setColor(Color.GREEN);
break;
}
}
canvas.drawRect(100, 100 * i, 100 * i, 100 + 100 * i, paint);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment