Reputation: 68
I need the String inside the textview to be animated from left to right so that when the text is removed from the right, it can be entered from the left, as shown below.
The text above (Compute Sentence Probability) must be animated as follows and removed from the image and entered on the other side ,as shown below.
I used the animation below, but in this animation the whole text comes from the right once to the left, and again it does not enter at the same time as the text leaves the other side, and the text does not enter again until the whole text is out.
animation
<?xml version="1.0" encoding="utf-8"?>
<translate xmlns:android="http://schemas.android.com/apk/res/android"
android:duration="6000"
android:fromXDelta="100%"
android:interpolator="@android:anim/linear_interpolator"
android:repeatCount="infinite"
android:repeatMode="restart"
android:toXDelta="-100%" />
Upvotes: 1
Views: 379
Reputation: 995
This answer work and if you want support right to left can add below code to TextView in xml
android:textDirection="rtl"
Upvotes: 1
Reputation: 1670
Remove all animation from TextView
and
In your xml file add textview
<TextView
android:id="@+id/tvUsername"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Computer Sentence Probability..........."
android:singleLine="true"
android:ellipsize="marquee"
android:marqueeRepeatLimit="marquee_forever"
android:scrollHorizontally="true"
/>
In java file simple add this line
TextView tvUsername = (TextView)findViewById(R.id.tvUsername);
tvUsername.setSelected(true);
Upvotes: 2