HeisenBerg HeisenBerg - 5 months ago 109
Android Question

Xamarin.Droid cannot convert from uint to Android.content.Res.colorStateList

I'm trying to use the

SetStroke
method of
GradientDrawable
to Set a Black border to a textView

GradientDrawable shape = new GradientDrawable();
shape.SetStroke(1, 0xFF000000);


I can't use it the same way like in java, I'm getting error

Error : Argument 2: cannot convert from 'uint' to 'Android.content.Res.colorStateList'

Answer

In Xamarin SetStroke(int width, int color) is not there.

You can use SetStroke(int width, Color color) instead.

Something like this :

GradientDrawable shape = new GradientDrawable();
shape.SetStroke(1, Resources.GetColor(Resource.Color.black);