ViewFlipper 将子视图堆叠在“outAnimation”上
我有一个 viewFlipper,可以在许多 textView 之间翻转。 由于某种原因,视图堆叠在 outAnimation 上。不是只有一个执行“动画内”和一个执行“动画外”,而是一个执行“动画内”,而所有先前的视图执行“动画外”,有人可以帮助我实现一种视图在输出时不会相互堆叠的状态吗?动画片?
这是翻转器 xml:
<ViewFlipper xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@+id/viewFlipper1"
android:background="#60000000"
android:inAnimation="@anim/flipper_transition_in"
android:outAnimation="@anim/flipper_transition_out"
android:autoStart="true"
android:flipInterval="5000">
<TextView android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textSize="20sp"
android:text="אין דבר העומד בפני הרצון"
android:textStyle="bold"
android:gravity="center"
android:textColor="#00ff00"
android:singleLine="true"
>
</TextView>
<TextView android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textSize="20sp"
android:text="קשה – זאת אומרת אפשר"
android:textStyle="bold"
android:gravity="center"
android:textColor="#00ff00"
android:singleLine="true"
>
</TextView>
<TextView android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textSize="20sp"
android:text="מי שלא מעז – לא מצליח"
android:textStyle="bold"
android:gravity="center"
android:textColor="#00ff00"
android:singleLine="true"
>
</TextView>
<TextView android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textSize="20sp"
android:text="אל תצפה לזה - תעבוד בשביל זה"
android:textStyle="bold"
android:gravity="center"
android:textColor="#00ff00"
android:singleLine="true"
>
</TextView>
<TextView android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textSize="20sp"
android:text="אל תוותר על מה שאתה רוצה"
android:textStyle="bold"
android:gravity="center"
android:textColor="#00ff00"
android:singleLine="true"
>
</TextView>
<TextView android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textSize="20sp"
android:text="דברים גדולים דורשים זמן"
android:textStyle="bold"
android:gravity="center"
android:textColor="#00ff00"
android:singleLine="true"
>
</TextView>
<TextView android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textSize="20sp"
android:text="כשתגיע לשם תצחק על כולם"
android:textStyle="bold"
android:gravity="center"
android:textColor="#00ff00"
android:singleLine="true"
>
</TextView>
以下是动画 xml:
在动画中:
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:interpolator="@android:anim/linear_interpolator"
>
<translate android:fromXDelta="-100%p" android:toXDelta="0" android:duration="5000"/>
输出动画:
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:interpolator="@android:anim/linear_interpolator"
>
<translate android:fromXDelta="0" android:toXDelta="100%p" android:duration="5000"/>
请注意,我的动画将文本从左向右翻译,这就是我需要的,而不是错误。 任何帮助将不胜感激!提前致谢!
I have a viewFlipper which flips between many textViews.
For some reason the views stack on outAnimation. instead of just one performing 'in animation' and one performing 'out animation' I got one performing 'in animation' and all previous views performing 'out animation', Can somebody help me achieve a state where views dont stack upon each other on out animation?
Here is the flipper xml:
<ViewFlipper xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@+id/viewFlipper1"
android:background="#60000000"
android:inAnimation="@anim/flipper_transition_in"
android:outAnimation="@anim/flipper_transition_out"
android:autoStart="true"
android:flipInterval="5000">
<TextView android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textSize="20sp"
android:text="אין דבר העומד בפני הרצון"
android:textStyle="bold"
android:gravity="center"
android:textColor="#00ff00"
android:singleLine="true"
>
</TextView>
<TextView android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textSize="20sp"
android:text="קשה – זאת אומרת אפשר"
android:textStyle="bold"
android:gravity="center"
android:textColor="#00ff00"
android:singleLine="true"
>
</TextView>
<TextView android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textSize="20sp"
android:text="מי שלא מעז – לא מצליח"
android:textStyle="bold"
android:gravity="center"
android:textColor="#00ff00"
android:singleLine="true"
>
</TextView>
<TextView android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textSize="20sp"
android:text="אל תצפה לזה - תעבוד בשביל זה"
android:textStyle="bold"
android:gravity="center"
android:textColor="#00ff00"
android:singleLine="true"
>
</TextView>
<TextView android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textSize="20sp"
android:text="אל תוותר על מה שאתה רוצה"
android:textStyle="bold"
android:gravity="center"
android:textColor="#00ff00"
android:singleLine="true"
>
</TextView>
<TextView android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textSize="20sp"
android:text="דברים גדולים דורשים זמן"
android:textStyle="bold"
android:gravity="center"
android:textColor="#00ff00"
android:singleLine="true"
>
</TextView>
<TextView android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textSize="20sp"
android:text="כשתגיע לשם תצחק על כולם"
android:textStyle="bold"
android:gravity="center"
android:textColor="#00ff00"
android:singleLine="true"
>
</TextView>
And here are the animation xmls:
in animation:
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:interpolator="@android:anim/linear_interpolator"
>
<translate android:fromXDelta="-100%p" android:toXDelta="0" android:duration="5000"/>
out animation:
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:interpolator="@android:anim/linear_interpolator"
>
<translate android:fromXDelta="0" android:toXDelta="100%p" android:duration="5000"/>
notice my animation translates the text from left to right, this is what i need, not a mistake.
any help would be greatly appreciated!!! thanks in advance!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
嘿,你的代码似乎有效。我确实对 viewflipper 标签做了一些小改动。
我没有使用你写的动画代码,而是使用了android sdk中的动画。
顺便说一句,您的代码没有结束 viewflipper 标签。而不是使用
使用 。您没有包含任何内容,因此结束标记并不是真正必要的。
Hey your code seems to work. I did make a small change in the viewflipper tag.
Instead of using the animation code you wrote, I used the animation in the android sdk.
Btw your code doesn't have an end viewflipper tag. And instead of using
use . You are not enclosing anything so the end tag isn't really necessary.