I often use a TextView withing a ScrollView as a quick log in early
prototype of apps, for debugging.
Typically I just set the selection to the end of the text, which moves
the caret and thus makes sure it's visible:

mLogTextView.append(msg);
mLogTextView.setSelected(true);
Spannable text = (Spannable) mLogTextView.getText();
Selection.setSelection(text, text.length());

R/


On Wed, May 27, 2009 at 7:28 PM, Peter Carpenter
<[email protected]> wrote:
> Hi guys,
>
>
>
> I can’t for the life of me work out how to get a text view to be displayed
> scrolled to the bottom.
>
>
>
> It appears that plenty of people have asked about this in newsgroups, but no
> solution offered.
>
>
>
> textView.setText(s);
>
> scrollView.fullScroll(ScrollView.FOCUS_UP);
>
>
>
> The above code is called, and whilst the text is updated correctly, the view
> is not scrolled.
>
> (I’ve tried ScrollView.FOCUS_DOWN) and that doesn’t work either
>
>
>
> Do I need to force the scrollView to measure itself before calling the
> scroll function?  If so what would be the best way to go about doing this
> and then calling the scroll.
>
>
>
> I’ve also tried setting the text as spannable and setting the cursor
> position to the end.
>
>
>
> Cheers,
>
>
>
> Peter.
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to