Android ViewFlipper在';outAnimation';
我有一个viewFlipper,可以在多个文本视图之间切换。 由于某些原因,视图在outAnimation上堆叠。除了一个执行“in-animation”和一个执行“out-animation”之外,我还有一个执行“in-animation”和所有以前的视图执行“out-animation”,有人能帮我实现这样一种状态,即在out-animation中视图之间不堆叠吗 以下是flipper xml:Android ViewFlipper在';outAnimation';,android,android-layout,viewflipper,android-animation,android-xml,Android,Android Layout,Viewflipper,Android Animation,Android Xml,我有一个viewFlipper,可以在多个文本视图之间切换。 由于某些原因,视图在outAnimation上堆叠。除了一个执行“in-animation”和一个执行“out-animation”之外,我还有一个执行“in-animation”和所有以前的视图执行“out-animation”,有人能帮我实现这样一种状态,即在out-animation中视图之间不堆叠吗 以下是flipper xml: <ViewFlipper xmlns:android="http://schemas.an
<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"/>
输出动画:
<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"/>
请注意,我的动画将文本从左向右翻译,这是我需要的,不是错误。
任何帮助都将不胜感激!!!提前谢谢 嘿,你的代码似乎很有效。我确实在viewflipper标记中做了一个小更改
<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="@android:anim/slide_in_left"
android:outAnimation="@android:anim/slide_out_right"
android:autoStart="true" android:flipInterval="5000">
我没有使用您编写的动画代码,而是使用了android sdk中的动画。
顺便说一句,您的代码没有EndViewFlipper标记。而不是使用
使用您没有包含任何内容,因此实际上不需要结束标记。如果使用设置动画,则需要有一个关闭标记。但是因为你只做了一个动画,所以不需要设置标签。如果你是这个意思的话,就有一个标签。。。否则eclipse不会让我编译它。不管怎么说,你知道为什么我的视图会堆积在动画中吗?我试过让孩子们消失,但没用(谢谢,这就足够了,尽管我无法判断视图是否与此动画叠加(因为速度的原因,这不是必需的)。如果你曾经遇到一种方法来制作一个不叠加视图的平移、恒定速度的动画,请将其张贴在这里:)顺便说一下,在sdk中的哪里可以看到所有提供的动画?在eclipse中,如果您点击android.R。您将获得sdk中所有资源的列表。顺便说一句,请给出答案。那么我不确定你的需求是什么,因为上面的方法就是如何在视图之间循环。但是如果你想要一个连续的滑块,这可能会有所帮助,谢谢,这正是我需要的效果。对不起,不能投票,说我需要至少15的声望:P