But let's say you want it to animate the text constantly? Here's a classic trick - pad the string until it goes out of the width of the view, so it will start the scrolling.
The hard part here was to find out how to calculate the line width (since the TextView itself doesn't supply that info. Had to dig android sources for that.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
resultView.setText(result); | |
while(resultView.getLayout().getLineWidth(0) < (resultView.getRight() - resultView.getLeft())) | |
resultView.setText(resultView.getText() + " "); |