I was recommended using a parent view to get horizontal scrolling right in my TextView:
<HorizontalScrollView android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TextView android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:scrollHorizontally="true"
android:gravity="center|right"
android:text="123456789"/>
</HorizontalScrollView>
Horizontal scrolling works fine but it makes the content overflow to the right when it gets longer than it's parent's width:
-------
|123456|7
-------
However I'm working on a textview that holds numbers and since numbers are commonly aligned to the right I need the textview to overflow to the opposite side. (you should have to scroll left to see the beginning of the string).
------
1|4567|
------
I have tried multiple combinations of gravity="right" and widths but I cannot manage to do it. How can I align the text to the right and make it overflow to the left?
EDIT:
I tried doing this when the user types:
calc.setText( newNumber );
HorizontalScrollView hsv = (HorizontalScrollView) findViewById(R.id.hsv);
hsv.scrollTo(hsv.getRight(), hsv.getTop());
This scrolls to the right every time the user types a number, however the latest number is always left out of the screen (it's like it scrolled and THEN added the number).