Closed sandeshlasnapure closed 7 years ago
Thanks, did that and removed underline.
@saket @sandeshlasnapure I am getting underline, attaching screen shot
here is my code
<TextView android:id="@+id/tvComments" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginTop="@dimen/value_2" android:textColor="@color/medium_black" android:textSize="@dimen/value_sp_17" android:textColorHighlight="@color/transparent" android:lineSpacingExtra="2dp" />
I think that's the default styling used by TextView. You'll have to manually replace those spans if you want.
val text: Spannable = ...
val urlSpans: Array<URLSpan> = text.getSpans(0, text.length, URLSpan::class.java)
for (urlSpan in urlSpans) {
val startIndex = text.getSpanStart(urlSpan)
val endIndex = text.getSpanEnd(urlSpan)
text.removeSpan(urlSpan)
text.setSpan(CustomUrlSpan(), startIndex, endIndex, 0)
}
@saket didnt work out, URLSpan count is 0
That's not possible. You should check your data flow to ensure you're getting the right text
.
Actually, pass Any
(or Object
in Java) as the span type to debug what spans are present in your text.
text.getSpans(0, text.length, Any::class.java)
That's not possible. You should check your data flow to ensure you're getting the right
text
.
I am sure.
URLs are only rendered when URLSpan
s are present in the text. If you're seeing linkified text then it means that there are URLSpans present in the text. It's contradictory otherwise.
The library doesn't add any underline span to links. Can you please add a screenshot? The highlight color can be changed by using
android:textColorHighlight="@color/your_color"
on your TextView. If you're trying to change the color on all TextViews across your app, you can add atextViewStyle
in your theme.