I have a TextView in a FrameLayout as follows:
<FrameLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
... >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:singleLine="true"
... />
The text of the TextView is set in code and I have a translate animation running on the TextView that slides it left across the parent View as follows:
myTextView.setText(getVenueInformationText());
myTextView.setAnimation(AnimationUtils.loadAnimation(myContext, R.anim.slide_left_repeatedly));
I need to cater for both the cases where the text in the TextView is shorter or wider than the width of the parent View (FrameLayout in this case) . However, I am finding that the width of the animated TextView is only ever as wide as the FrameLayout (and thus my text is chopped).
Does anyone know why, when I set the text on my TextView and set the animation, the TextView appears only ever as wide as the FrameLayout (even if the text in the TextView should stretch it to be wider than the FrameLayout)?
Note 1: A marquee animation on the TextView won't do the job for me as it is possible for the text in the TextView to be smaller than the width of the parent View (in which case the marquee animation does not run... and I need the animation to run regardless of the text's width).
Note 2: Below is the xml definition of the translate animation I am using:
<translate
xmlns:android="http://schemas.android.com/apk/res/android"
android:interpolator="@android:anim/linear_interpolator"
android:fromXDelta="100%p"
android:toXDelta="-100%"
android:repeatCount="infinite"
android:duration="15000" />