draw Frame Border on Canvas - Android Graphics

Android examples for Graphics:Canvas

Description

draw Frame Border on Canvas

Demo Code


//package com.java2s;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.Rect;

public class Main {
    public static void drawFrameBorder(Canvas canvas, Paint paint,
            Rect frame) {//from   w  ww.j  a  v  a 2 s .  c o m
        canvas.drawRect(frame.left, frame.top, frame.right + 1,
                frame.top + 2, paint);
        canvas.drawRect(frame.left, frame.top + 2, frame.left + 2,
                frame.bottom - 1, paint);
        canvas.drawRect(frame.right - 1, frame.top, frame.right + 1,
                frame.bottom - 1, paint);
        canvas.drawRect(frame.left, frame.bottom - 1, frame.right + 1,
                frame.bottom + 1, paint);
    }
}

Related Tutorials