Пример #1
0
 @Override
 public void draw(Canvas canvas) {
   canvas.save();
   canvas.rotate(mRotation, getBounds().centerX(), getBounds().centerY());
   super.draw(canvas);
   canvas.restore();
 }
Пример #2
0
 @Override
 public void draw(Canvas canvas) {
   Rect bounds = getBounds();
   canvas.saveLayerAlpha(
       bounds.left, bounds.top, bounds.right, bounds.bottom, mAlpha, Canvas.ALL_SAVE_FLAG);
   super.draw(canvas);
   canvas.restore();
 }
 @Override
 public void draw(Canvas canvas) {
   canvas.save();
   if (mHasSecondDrawable) {
     int alpha = Math.min(Math.max(0, Math.round(mRotation / mMaxRotation * 255)), 255);
     canvas.rotate(mRotation, getBounds().centerX(), getBounds().centerY());
     getDrawable(0).setAlpha(255 - alpha);
     getDrawable(0).draw(canvas);
     canvas.rotate(-mMaxRotation, getBounds().centerX(), getBounds().centerY());
     getDrawable(1).setAlpha(alpha);
     getDrawable(1).draw(canvas);
   } else {
     canvas.rotate(mRotation, getBounds().centerX(), getBounds().centerY());
     super.draw(canvas);
   }
   canvas.restore();
 }