How can I make a TextView automatically scroll as I add more lines of text?
From your Code, two steps have to do:
Step 1
Although you code in Xamarin Android, but as in Java in the xxxActivity.java for terminalOutput invoke must be like this
TextView outputText = (TextView) findViewById(R.id.terminalOutput);
outputText.setMovementMethod(new ScrollingMovementMethod());
Method setMovementMethod() by parameter ScrollingMovementMethod() is the gimmick.
Step 2
And in the layout as in Java-Android also in activity_xxx.xml for the TextView Declaration as above must have to add this
android:gravity="bottom"
When you add new line into the outputText like this:
outputText.append("\n"+"New text line.");
It will scroll to the last line automatically, and these all the magic for your need.
As per answer here Making TextView Scrollable in Android
You don't need to use a ScrollView actually.
Just set the
android:maxLines = "AN_INTEGER"
android:scrollbars = "vertical" properties of your TextView in your layout's xml file.
Then use:
yourTextView.setMovementMethod(new ScrollingMovementMethod());
in your code.
That will work..