draw Border on Canvas - Android android.graphics

Android examples for android.graphics:Canvas

Description

draw Border on Canvas

Demo Code

import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.Path;

public class Main{

    public static void drawBorder(int width, int height, Canvas canvas,
            Paint paint, Path workingPath) {

        paint.setStyle(Paint.Style.STROKE);
        workingPath.reset();// w w w  .  jav  a 2  s . c  o m
        workingPath.moveTo(0, 0);
        workingPath.lineTo(width, 0);
        workingPath.lineTo(width, height);
        workingPath.lineTo(0, height);
        workingPath.lineTo(0, 0);
        workingPath.close();

        canvas.drawPath(workingPath, paint);

    }

}

Related Tutorials