【发布时间】:2013-03-06 08:06:40
【问题描述】:
transition drawable 中可以有超过 2 个项目吗?我需要更改背景,以便第二帧淡入,而不是第三帧,依此类推到第四帧...
现在我有这个:
<?xml version="1.0" encoding="UTF-8"?>
<transition xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/voting_button_not1"/>
<item android:drawable="@drawable/voting_button_not2"/>
<item android:drawable="@drawable/voting_button_not3"/>
<item android:drawable="@drawable/voting_button_not4"/>
<item android:drawable="@drawable/voting_button_not5"/>
<item android:drawable="@drawable/voting_button_not1"/>
</transition>
我得到了按钮:
<ImageButton android:id="@+id/skipButton"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/coldf1f2"
android:scaleType="fitCenter"
android:adjustViewBounds="true"/>
附:没关系,它是一个 ImageButton,这没有任何区别。
在我的代码中,我得到了这样的东西:
TransitionDrawable vote_not = (TransitionDrawable)skip.getBackground();
vote_not.startTransition(1000);
它播放从第一项到第二项的过渡。但我需要播放完整列表。
【问题讨论】:
-
发布您的代码。你现在有什么?
-
你有没有找到一种方法来做多个过渡?我想要一叠 6 张照片,而不是随机更换一张。
-
制作 TrasitionDrawable 列表,请参阅 [this answer by yahor10][1] 。 [1]:stackoverflow.com/questions/13284221/android-transition
标签: android transition android-drawable transitiondrawable