Friday, April 9, 2010

Preventing TextView with links inside a ScrollView from dimming

I wrote an Android application that shows a scrollable TextView because I put it inside a ScrollView. When I added links to the TextView, I had to execute this so that the links can be clicked with proper highlighting:

textView.setLinksClickable(true);
textView.setMovementMethod(LinkMovementMethod.getInstance());

It works:

However, when I use my finger to scroll it, the text other than links are dimmed, very, very dark until we can almost see nothing.
Calling setClickable(false) and setLongClickable(false) fixed the issue, but the link itself is not highlighted anymore when "hovered", and the user may think that the link is not clickable.

I found a solution, which is not perfect, but works. Just set the color of the TextView. The links will stay on the same color, but the normal text will change color, and it does not dim anymore!

Here is what I get using #fff (a.k.a. 0xffffffff) color.

No comments:

Post a Comment