简体   繁体   English

有没有一种简单的方法可以从 Android Studio 中的链接 TextView 文本中删除下划线?

[英]Is there a simple way to remove an underline from linked TextView text in Android Studio?

After searching for an hour there doesn't seem to be a simple (without adding classes and many functions) of removing the underline of a link.搜索了一个小时后,删除链接的下划线似乎并不简单(不添加类和许多功能)。

I have this code:我有这个代码:

    newsTitle.setText(Html.fromHtml("<a href=\""+ currentNewsItem.getOriginUrl() + "\">" + currentNewsItem.getTitle() + "</a>"));
    newsTitle.setMovementMethod(LinkMovementMethod.getInstance());

It comes out like this:结果是这样的:

在此处输入图像描述

Is there a simple XML tag or a line of code which will remove the underline from the text?是否有一个简单的 XML 标签或一行代码可以删除文本中的下划线?

Try this solution.试试这个解决方案。 It should work for textview and editext它应该适用于 textview 和 editext

   android:background="@null"

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

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