Scrolling TextView without the dimming effect?

by sh...@kfold.org » Fri, 10 Apr 2009 01:48:03 GMT


Sponsored Links
 I have an application that uses TextView with scrolling and it has a
very annoying effect that dims the text when touch based scrolling is
used so you can barely see the text you are trying to scroll. (Same
effect in the emulator when you click the mouse and scroll).

I'm not sure where this effect is coming from or how to get rid of it.
(I have a guess that it may have something to do with text selection
for copy/paste?) Anyone know how to help?

More info:

TextView is nested in LinearLayout like so:
...
        <TextView android:layout_height="wrap_content" android:id="@+id/text"
                android:scrollbars="vertical" android:scrollHorizontally="true"
                android:textSize="10sp" android:typeface="monospace"
                android:layout_width="fill_parent" android:layout_weight="1"></
TextView>
...

In onCreate() I make the TextView scollable like so:
        TextView tv = (TextView) findViewById(R.id.text);
        tv.setMovementMethod(ScrollingMovementMethod.getInstance());

Note that when I nest TextView in a ScrollView (and disable scrolling
on the TextView) it does not dim and works nicely... only problem is
that ScrollView doesn't support horizontal scrolling of TextView which
I need.

You can download beta1 of RoboTop though the Market to see what I
mean.
Full source is available here:  http://www.kfold.com/m/RoboTop-beta1.zip 


--~--~---------~--~----~------------~-------~--~----~



Scrolling TextView without the dimming effect?

by sh...@kfold.org » Fri, 10 Apr 2009 01:48:42 GMT


 When scrolling in a TextView it has an annoying effect that dims the
background while scrolling (touch scrolling). This makes the text very
hard to read and difficult for the user to know when to stop
scrolling. See RoboTop application in the market to see what I mean.

I'm not sure what is causing the dimming effect or how to disable it.
Any thoughts? (One guess is that it may have something to do with text
selection for cut and paste).

Note that wrapping a TextView in a ScrollView (and disabling the
scrolling on the TextView and enabling it on the ScrollView) scrolls
nicely without dimming. However, ScrollView can only scroll vertically
and I need to scroll both horizontally and vertically (which TextView
can do when enabled).

More details:

TextView is in a LinearLayout like so:
        <TextView android:layout_height="wrap_content" android:id="@+id/text"
                android:scrollbars="vertical" android:scrollHorizontally="true"
                android:textSize="10sp" android:typeface="monospace"
                android:layout_width="fill_parent" android:layout_weight="1"></
TextView>

Scrolling of TextView is enabled in OnCreate() like so:
       _Text = (TextView) findViewById(R.id.text);
        _Text.setMovementMethod(ScrollingMovementMethod.getInstance
());

Full source is available at  http://www.kfold.com/m/RoboTop-beta1.zip 


--~--~---------~--~----~------------~-------~--~----~


Sponsored Links


Scrolling TextView without the dimming effect?

by sh...@kfold.org » Sat, 11 Apr 2009 07:07:48 GMT


 Answer for posterity:

Need to setClickable and setLongClickable to false (must be both,
setting one or the other still causes dimming).

Need to set above _after_ calling setMovementMethod
(ScrollingMovementMethod.getInstance()). Setting XML properties
doesn't work since they seem to be overridden by call to
ScrollingMovementMeathod.

   _Text = (TextView) findViewById(R.id.text);
   _Text.setMovementMethod(ScrollingMovementMethod.getInstance());
   _Text.setClickable(false);     // Both Clickable and LongClickable
must be turned off
   _Text.setLongClickable(false); // after setting the MovementMeathod
in order to avoid dimming effect




--~--~---------~--~----~------------~-------~--~----~



Other Threads

1. filter a listview with an arrayadapter not of String type

Hi everybody,

I've found here :
http://stackoverflow.com/questions/1737009/answer-to-making-a-nice-lo...

How to make a text filter on an arrayadapter<String>, my problem as
you can see on the post hereabove is that my adapter is not of String
type, and then when I use methods getFilter.filter(s), nothing happens
because i'm comparing a CharSequence to an object containing several
strings and data...
If someone had  any idea, that would be great
(I also posted that in beginner's group, but maybe it's better here...)

-- 

2. notepadv3 crashes on Motorola Droid

I installed the notepadV3 solution with no modifications on my
Motorola Droid. When I try to edit a note and the screen orientation
changes (i.e. I hold it horizontally), or if I open the Droid up so
the keyboard is exposed, the program freezes and crashes.

I'm not able to figure out why this is going on. Any ideas?

-- 

3. A WAP PUSH Broadcast Receiver!!!

4. HowTo make ListView Larger so more than one item visible at a time ?

5. Upgrading an app in the background

6. HowTo make ListView Larger so more than one item visible at a time ?

7. SurfaceView and View Flipper