I have a text view that has one aligned Arabic (right to left) text. The content of the text increases in time, and the last (leftmost) part should always be displayed. First, the horizontal scroll bar is set to the right, and when you scroll the text, it automatically scrolls to the left.
This code works fine on an Android 2.3 phone. This comes from layout.xml
<TextView android:id="@+id/textView1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:ellipsize="none" android:fadingEdge="horizontal" android:gravity="right" android:scrollHorizontally="true" android:scrollbars="horizontal" android:singleLine="true" android:text="@string/txt_start" android:textAppearance="?android:attr/textAppearanceLarge" />
I have it in the onCreate () method of my activity
tv = (TextView) findViewById(R.id.textView1); tv.setMovementMethod(new ScrollingMovementMethod());
The problem is the inconsistent behavior of the text view on phones with Android 4.0+. The horizontal scrollbar does not fit right first, so the TextView is initially empty! If I try to scroll through empty text, text will appear. When additional text is added, the scroll bar does not scroll to display the new text, but if I manually scroll the text, it appears.
I searched stackoverflow and tried to add the following properties without success.
android:focusable="true" android:focusableInTouchMode="true"
source share