Android - 繪製空心圓

摘要:Android - 繪製空心圓

        // 繪製空心圓
        Paint circlePaint = new Paint();
        circlePaint.setAntiAlias(true); //設置畫筆為無鋸齒
        circlePaint.setColor(Color.WHITE); //設置畫筆顏色 
        circlePaint.setStrokeWidth((float) 3.0); //線寬 
        circlePaint.setStyle(Style.STROKE); //空心效果
        
        Rect rectCircle = new Rect(3, 3, bitmap.getWidth()-3, bitmap.getHeight()-3);
        RectF rectCircleF = new RectF(rectCircle);
        
        canvas.drawOval(rectCircleF, circlePaint);