Reputation: 20596
Let's say I have following text in TextView:
Hey there, visit www.example.com
If I set TextView's attribute autoLink="all" www.example.com will be properly detected. However, if I now touch TextView, TextView's text that's not link ('Hey there, visit' part) will go gray. Is there a way to prevent this behavior?
Thanks!
Upvotes: 8
Views: 9363
Reputation: 28152
In xml you can simply do following:
Set color for text with:
android:textColor="@color/yourcolor"
Set color for links with:
android:textColorLink="@color/yourcolor"
Upvotes: 13
Reputation: 61
If you can get away with doing it in code instead of XML, the trick below worked for me even though it's kind of redundant. You're basically setting the text color to what it is now. It's not necessarily "white" as others have said; it's a shade of gray. Regardless of the color, this gets it and sets it again.
final TextView message = new TextView(TheApp.this);
final SpannableString s = new SpannableString("Some text with example.com in it.");
message.setText(s);
...
message.setTextColor(message.getTextColors().getDefaultColor());
...
Linkify.addLinks(message, Linkify.WEB_URLS);
Upvotes: 6
Reputation: 159
Guys, looks like a weird bug to me, but i found a solution, use HTML to give the text a shade of white:
text.append(Html.fromHtml("
That's it! With #FFFFFF it blinks, without, not. duh.
Upvotes: -1
Reputation: 42964
Tried changing any of these properties of your TextView ?
android:focusable - Boolean that controls whether a view can take focus.
android:focusableInTouchMode - Boolean that controls whether a view can take focus while in touch mode.
android:hapticFeedbackEnabled - Boolean that controls whether a view should have haptic feedback enabled for events such as long presses.
android:clickable - Defines whether this view reacts to click events.
I guess setting one of these to false would disable the visual feedback on the text elements.
Upvotes: 0