protected void onDraw(Canvas canvas) {
// TODO Auto-generated method stub
Paint mPaint = new Paint();
mPaint.setAntiAlias(true);
mPaint.setStyle(Paint.Style.STROKE);
mPaint.setColor(Color.parseColor("#26ffffff"));
mPaint.setStrokeWidth(3);
canvas.drawCircle(80, 80, 80, mPaint);
Paint arcPaint = new Paint();
arcPaint.setAntiAlias(true);
arcPaint.setStyle(Paint.Style.STROKE);
arcPaint.setColor(Color.parseColor("#d08cc9"));
arcPaint.setStrokeWidth(3);
RectF mRectF = new RectF(0, 0, 160, 160);
canvas.drawArc(mRectF, 0f, 90f, false, arcPaint);
super.onDraw(canvas);
}
這是你畫上去的內容,view當然不知道內容多大了,如果這樣,你就要設置view的長和寬才行