In Google Play when the name of a certain title is too long then they apply an animation on this TextView
when the name is going out from one end of the TextView
, goes in from the other end, stops for a second on the beginning of the Title text, and then goes for the next round.
Does anyone have any explanation how can this be achieved?
This was what worked for me, you have to actually request for focus in order for the marquee animation to work:
<TextView
android:id="@+id/tvAddress"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="@+id/tvName"
android:layout_toLeftOf="@+id/ivLogo"
android:text=""
android:textColor="@color/cups_white"
android:textSize="18sp"
android:ellipsize="marquee"
android:singleLine="true"
android:marqueeRepeatLimit ="marquee_forever"
android:scrollHorizontally="true"
android:focusable="true"
android:focusableInTouchMode="true"
android:duplicateParentState="true">
<requestFocus
android:focusable="true"
android:focusableInTouchMode="true"
android:duplicateParentState="true" />
</TextView>
In your xml file where the TextView is declared you can use the following attributes:
android:ellipsize="marquee"
android:marqueeRepeatLimit="marquee_forever"
android:singleLine="true"
with the singleline you going sure thats the Text is showend only in one line.
For more details look at this: http://developer.android.com/reference/android/widget/TextView.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With