Android examples for android.graphics:Canvas
draw Round Rectangle on Canvas
import android.graphics.Canvas; import android.graphics.Paint; import android.graphics.RectF; import android.os.Build; public class Main { private static final RectF TMP_RECT = Build.VERSION.SDK_INT < 21 ? new RectF() : null; public static void drawRoundRect(Canvas canvas, float left, float top, float right, float bottom, float rx, float ry, Paint paint) {//from w w w . j a va 2 s . c o m if (Build.VERSION.SDK_INT < 21) { TMP_RECT.set(left, top, right, bottom); canvas.drawRoundRect(TMP_RECT, rx, ry, paint); } else { canvas.drawRoundRect(left, top, right, bottom, rx, ry, paint); } } }