tags:

views:

39

answers:

1

Hello all,

Does smomeone know how I set the scrollbar position in an EditView programmatically.

I'm appending the text during special events but I want the EditView to scroll down to the latest text added so it'll be visible. But default the scrollbar does not move automatically when appending text.

/ Henrik

+1  A: 

Just call yourEditText.scrollBy(int x, int y) after you added text to your EditText. Maybe you have to test some values until you find the appropriate values

Roflcoptr
Thanks for the answer. But isn't there any "nice looking way" to select a Y that' fits. I.e. just "trying a few values", couldn't that mess up future compatibility for different screen sizes etc?
Henrik
then just use a value high enough to always scroll to the bottom. e.g. Integer.MAX_VALUE
Roflcoptr
Thanks for the help, really appreciate it :-)
Henrik