-1

Sample code :

using Android.Graphics;

int _color
Paint mPaint;

mPaint.Color = ?     // Here I'm confused.

In Java :

mPaint.setColor( _color );

What will be in Xamarin.Android ?

How to set color in Paint from int ?


Reference i made :


Any answers !

Yksh
  • 3,276
  • 10
  • 56
  • 101
  • Not sure why you are using an `int` to store the value of a color, but this might help: http://stackoverflow.com/questions/2534116/how-to-convert-get-rgbx-y-integer-pixel-to-colorr-g-b-a-in-java – Jeremy Thompson Jan 15 '16 at 04:38
  • I just want to know the Xamarin equivalent of **Android,Graphics.Paint.setColor(int color)**in Java – Yksh Jan 15 '16 at 06:42
  • Sure just pull out your favourite Java decompiler and see... – Jeremy Thompson Jan 15 '16 at 07:58

1 Answers1

1

At last I got a solution for this.

Methods which start with get and set may be mapped to properties:

http://developer.xamarin.com/guides/android/advanced_topics/api_design/#Properties

The Paint.setColor(int) method is bound as the Paint.Color property:

http://developer.xamarin.com/api/property/Android.Graphics.Paint.Color/

Instead of an int value, it instead takes an Android.Graphics.Color structure:

mPaint.Color = new Android.Graphics.Color (_color);

Refer : Bug 37716

Thanks @Jonathan_Pryor.

Yksh
  • 3,276
  • 10
  • 56
  • 101