简体   繁体   English

XAMARIN(C#) - 有没有办法以编程方式为TextView加下划线?

[英]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 also a way to do it by predefining it in xml file as well. 我知道还有其他一些方法可以做到这一点(我认为在Java中你会做这样的事情.SetPaintFlags(Paint.Underline_Text_Flag); ) - 我确实理解它可以使用Draw Line进行模拟,并且还有一个通过在xml文件中预定义它来实现它的方法。

The question is how to accomplish it **programmatically in Xamarin (C#)? 问题是如何 在Xamarin(C#)中 以编程方式完成它 There should be a property on the object or some way to set it** 对象上应该有一个属性或者某种方式来设置它**

Most "Set" methods in Android are converted to C# Properties in Xamarin. Android中的大多数“Set”方法都转换为Xamarin中的C#Properties。 So 所以

SetPaintFlags(Paint.Underline_Text_Flag);

becomes

my_object.PaintFlags = PaintFlags.UnderlineText;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM