hi so i was working on an calculator app so for textview in need to scroll it from right to left but its only working ltr what can i do?
<HorizontalScrollView
android:id="@ id/ScrollView"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@null"
android:scrollbars="none"
>
<TextView
android:text="0"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@ id/textView1"
android:layout_marginTop="10dp"
android:textSize="60sp"
android:textColor="@android:color/white"
android:maxLines="1"
android:scrollbars="none"
android:layout_gravity="right"
/>
</HorizontalScrollView>
CodePudding user response:
You could use the FocusSearchDirection.Right
to make the textview start scrolling from right to left.
<HorizontalScrollView
android:id="@ id/ScrollView"
android:layoutDirection="rtl"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#007b12"
android:scrollbars="none">
<TextView
android:text="zzzzzzzzzzzzzzztfytytytytytytytytytytytytgjjjjjjjjjjjjjjjjjjjjjiylhnhjk7fj"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@ id/textView1"
android:layout_marginTop="10dp"
android:textSize="60sp"
android:textColor="@android:color/white"
android:maxLines="1"
android:scrollbars="none"
android:layout_gravity="right"/>
</HorizontalScrollView>
Code behind:
var scrollview = FindViewById<HorizontalScrollView>(Resource.Id.ScrollView);
scrollview.PostDelayed(new Runnable(()=>
{
scrollview.FullScroll(FocusSearchDirection.Right);
}), 100L);