Well, I apologize for how messy this code is, but I still can't figure out how to put the code correctly. So I am making an application for Android (Java) and I have a scrollable text box. If the user scrolls a long line down and remains at the end when they click on the next line, and if it is short, it will scroll on this element, even if it can be a line with 1 line (and without scrolling). I was wondering if there is a way in which I can call something immediately after txtLvlInfo.setText to reset the x-scroll value to 0 or something such that it always reset at the top of the content, long or short. Thanks for any help with this and please let me know if I need to clarify more.
TextView txtLvlInfo = (TextView) findViewById(R.id.txtLevelInfo); txtLvlInfo.setMovementMethod(new ScrollingMovementMethod()); switch (v.getId()){ case R.id.row1: txtLvlInfo.setText("1: My text view is only two lines max and so I set it to scroll, if the user clicks row2 to load that text while having me scrolled down they have to click and pull to drag back down to the top of text view 2 row."); break; case R.id.row2: txtLvlInfo.setText("I only fill line 1 of the two."); break; }
_
<TextView android:textColor="#052027" android:text="" android:id="@+id/txtLevelInfo" android:scrollbars="vertical" android:layout_alignParentLeft="true" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_toRightOf="@+id/minimizeBtn" android:layout_marginRight="38dip"> </TextView>
Kisnardonline
source share