Home » Android » android – XAMARIN (C#) – Is There A Way To Underline A TextView Programmatically?

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

Posted by: admin June 15, 2020 Leave a comment

Questions:

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 also a way to do it by 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 some way to set it**

How to&Answers:

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

SetPaintFlags(Paint.Underline_Text_Flag);

becomes

my_object.PaintFlags = PaintFlags.UnderlineText;