Alexey F Shevelyov Alexey F Shevelyov - 4 months ago 45
Android Question

XAMARIN (C#) - Is There A Way To Underline A TextView Programmatically?

I know there are some other ways to do it (I think in Java you do something like this

.SetPaintFlags(Paint.Underline_Text_Flag);
) - and I do understand that it could be sort of emulated using the Draw Line and there is a way to do it predefining it in xml file as well.

The question is how to accomplish it **programmatically in Xamarin (C#)? There should be a property on the object or someway to set it**

Answer

Most "Set" methods in Android are converted to C# Properties in Xamarin. So

SetPaintFlags(Paint.Underline_Text_Flag);

becomes

my_object.PaintFlags = PaintFlags.UnderlineText;