Guest User

Untitled

a guest
Jun 25th, 2018
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.77 KB | None | 0 0
  1. package test.test;
  2.  
  3. import android.content.Context;
  4. import android.graphics.Canvas;
  5. import android.graphics.Paint;
  6. import android.graphics.RectF;
  7. import android.view.View;
  8.  
  9. public class Doll extends View
  10. {
  11.     private final Head head;
  12.    
  13.     public Doll(Context context, Head head)
  14.     {
  15.         super(context);
  16.  
  17.         this.head = head;
  18.     }
  19.    
  20.     @Override
  21.     protected void onDraw(Canvas canvas)
  22.     {
  23.         super.onDraw(canvas);
  24.        
  25.         canvas.drawCircle(head.x, head.y, head.radius, head.paint);    
  26.     }
  27. }
  28.  
  29. class Head
  30. {
  31.     protected float x;
  32.     protected float y;
  33.     protected int radius;
  34.     protected Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG);
  35.    
  36.     public Head(float x, float y, int radius)
  37.     {      
  38.         paint.setColor(0xFF0077BD);
  39.         this.x = x;
  40.         this.y = y;
  41.         this.radius = radius;
  42.     }
  43. }
Add Comment
Please, Sign In to add comment