0

I need to draw text on a TextView in a bottom up fashion, i.e., draw the last line of the text first at the bottom, then the second last line of the text and so on. How can I do that?

I am trying to follow the solution given in this post - Paginating text in Android.

TextView draws the text top down. What I want to achieve is given a text, I would like the last line of the view filled first, then the second last line and so on, Hence filling the first line in the last iteration. I tried creating a Custom TextView and overriding its onDraw method, but nothing seems to work.

Community
  • 1
  • 1

2 Answers2

0

Create a custom textview. In the setText method, do some string manipulation. Basically rearranging the text in the string so that the first line I the new text string is the last line of the old text string. Pass the new text string to the super.setText

Snake
  • 14,228
  • 27
  • 117
  • 250
0

If it is not scrollable textview you can set android:gravity="bottom|left" or "bottom|right" if you want right alignment. With this method width and hight can't be wrap_content.

Ivan Marincic
  • 58
  • 2
  • 7