gpt4 book ai didi

android - 如何为 ViewSwitcher 提供动画

转载 作者:可可西里 更新时间:2023-11-01 19:09:35 25 4
gpt4 key购买 nike

我创建了一个由 ViewSwitcher 组成的广告控件....

在那个控件中我有 ImageView 和 TextView 因为广告是文本或图像..

现在我必须给广告添加动画..

我试过跟随

Animation inAnimation = AnimationUtils.loadAnimation(this, android.R.anim.slide_in_left); inAnimation.setDuration(1500);

Animation outAnimation = AnimationUtils.loadAnimation(this, android.R.anim.slide_out_right); outAnimation.setDuration(1500);

然后我将它设置为切换器

ViewSwitcher switcher;

switcher.setInAnimation(inAnimation);

switcher.setOutAnimation(outAnimation);

但它不会工作..

请给我任何其他选择..或者如果上面代码的使用是错误的那么如何使用它??

最佳答案

尝试将xml中的动画设置为

<ViewSwitcher
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:inAnimation="@android:anim/slide_in_left"
android:outAnimation="@android:anim/slide_out_right" >

关于android - 如何为 ViewSwitcher 提供动画,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10532141/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com