如下的一段代码,是想实现on->off和off->on状态的变化过程,但实际情况是个transition都会走一遍,状态是off->on的transition没走,好像只走了on->off,如果颠倒过来,又只走了on->off。我是希望在on->off状态走一个transition,在off->on状态走另一个transition
<animated-selector xmlns:android="http://schemas.android.com/apk/res/android" >
<item
android:id="@+id/menubtn_on"
android:drawable="@drawable/ic_menu_moreoverflow_activated"
android:state_selected="true"/>
<item
android:id="@+id/menubtn_off"
android:drawable="@drawable/ic_menu_moreoverflow"/>
<transition
android:fromId="@id/menubtn_off"
android:toId="@id/menubtn_on" >
<animated-vector
android:drawable="@drawable/ic_menu_moreoverflow" >
<target
android:name="second_p"
android:animation="@animator/ic_menu_animation_2" />
<target
android:name="third_p"
android:animation="@animator/ic_menu_animation_3" />
</animated-vector>
</transition>
<transition
android:fromId="@id/menubtn_on"
android:toId="@id/menubtn_off" >
<animated-vector android:drawable="@drawable/ic_menu_moreoverflow_activated" >
<target
android:name="second_p"
android:animation="@animator/ic_menu_animation_b2" />
<target
android:name="third_p"
android:animation="@animator/ic_menu_animation_b3" />
</animated-vector>
</transition>
</animated-selector>
<animated-selector xmlns:android="http://schemas.android.com/apk/res/android" >
<item
android:id="@+id/menubtn_on"
android:drawable="@drawable/ic_menu_moreoverflow_activated"
android:state_selected="true"/>
<item
android:id="@+id/menubtn_off"
android:drawable="@drawable/ic_menu_moreoverflow"/>
<transition
android:fromId="@id/menubtn_off"
android:toId="@id/menubtn_on" >
<animated-vector
android:drawable="@drawable/ic_menu_moreoverflow" >
<target
android:name="second_p"
android:animation="@animator/ic_menu_animation_2" />
<target
android:name="third_p"
android:animation="@animator/ic_menu_animation_3" />
</animated-vector>
</transition>
<transition
android:fromId="@id/menubtn_on"
android:toId="@id/menubtn_off" >
<animated-vector android:drawable="@drawable/ic_menu_moreoverflow_activated" >
<target
android:name="second_p"
android:animation="@animator/ic_menu_animation_b2" />
<target
android:name="third_p"
android:animation="@animator/ic_menu_animation_b3" />
</animated-vector>
</transition>
</animated-selector>