Android_不幸运的大转盘(2)

时间:2023-02-09 13:48:10
3.绘制抽奖转盘的盘快
    private voiddraw() {
      try {
         mCanvas = mHolder.lockCanvas();

         if (mCanvas != null) {
            //绘制背景
            drawBg();
            
            //绘制盘块
            float tmpAngle = mStartAngle;
            float sweepAngle = 360/mItemCount;
            
            for (int i = 0; i < mItemCount; i++) {
               mArcPaint.setColor(mColor[i]);
               //绘制盘块
               mCanvas.drawArc(mRange, tmpAngle, sweepAngle,true, mArcPaint);
               
               //绘制文本
               drawText(tmpAngle,sweepAngle,mStrs[i]);
               
               //绘制icon