简体   繁体   中英

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?

Try this solution. It should work for textview and editext

   android:background="@null"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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