This is rough and quick, but after a couple of minutes looking aroudn
I didn't find anything about asking Google to auto-scroll my TextView
(I'm sure there are several ways to do this), so I used this for now.


    public void AdjustScroll( TextView in_oTextView )
    {
        /*
                We know how big the control is, we know how big
                a line is, we know how many lines there are,
                so how much do we have to scroll to keep the latest
                data in view?
        */
        int l_nLineCount = in_oTextView.getLineCount();
        int l_nViewHeight = in_oTextView.getHeight();
        int l_nPixelsPerLine = in_oTextView.getLineHeight();

        //The difference between view height and total text height
        int l_nDifference = ( l_nLineCount * l_nPixelsPerLine ) -
l_nViewHeight;

        if( l_nDifference < 1 )
        {
                return;
        }

        in_oTextView.scrollTo( 0, l_nDifference );
    }
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to