getWidth() public méthode

public getWidth ( ) : int
Résultat int
Exemple #1
0
		protected override void onDraw (Canvas canvas)
		{

			Console.WriteLine ("DRAW: {0} {1}", canvas.getWidth (), canvas.getHeight ());

			RectF r = new RectF (0, 0, canvas.getWidth (), canvas.getHeight ());
			Paint paint = new Paint ();

			using (Shader shader = make_grad (canvas.getWidth(), canvas.getHeight()))
				paint.setShader (shader);
			canvas.drawRect (r, paint);
		}
Exemple #2
0
		protected override void onDraw(Canvas canvas)
		{
			canvas.drawColor(Color.YELLOW);
			int width = canvas.getWidth();
			int height = canvas.getHeight();

			Paint paint = new Paint();
			paint.setColor(Color.RED);
			paint.setStyle(Paint.Style.STROKE);
			paint.setStrokeWidth(10);
			canvas.drawCircle(width / 2, height / 2, height / 3, paint);

			Paint inner = new Paint();
			paint.setColor(Color.GREEN);
			paint.setStyle(Paint.Style.FILL);
			canvas.drawCircle(width / 2, height / 2, height / 3 - 10, inner);

			Paint text = new Paint();
			text.setTextSize(20);
			canvas.drawText("I am a Xobot Monkey!", width / 8, height / 8, text);
		}